Skip to content

Commit 5f2a32a

Browse files
committed
Add support for Ruby keyword arguments
Ruby keyword arguments are represented differently than positional arguments in the MaD format: they are represented as `Method[key:]`. The framework endpoints query also returns the name as `key:`, so we can detect these and format them as such.
1 parent b348356 commit 5f2a32a

File tree

1 file changed

+13
-4
lines changed
  • extensions/ql-vscode/src/model-editor/languages/ruby

1 file changed

+13
-4
lines changed

extensions/ql-vscode/src/model-editor/languages/ruby/index.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,19 @@ export const ruby: ModelsAsDataLanguage = {
160160
},
161161
getArgumentOptions: (method) => {
162162
const argumentsList = getArgumentsList(method.methodParameters).map(
163-
(argument, index): MethodArgument => ({
164-
path: `Argument[${index}]`,
165-
label: `Argument[${index}]: ${argument}`,
166-
}),
163+
(argument, index): MethodArgument => {
164+
if (argument.endsWith(":")) {
165+
return {
166+
path: `Argument[${argument}]`,
167+
label: `Argument[${argument}]`,
168+
};
169+
}
170+
171+
return {
172+
path: `Argument[${index}]`,
173+
label: `Argument[${index}]: ${argument}`,
174+
};
175+
},
167176
);
168177

169178
return {

0 commit comments

Comments
 (0)