Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions extensions/ql-vscode/src/model-editor/languages/python/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,26 @@ export const python: ModelsAsDataLanguage = {
// Argument and Parameter are equivalent in Python, but we'll use Argument in the model editor
const argumentsList = getArgumentsList(method.methodParameters).map(
(argument, index): MethodArgument => {
// Keyword-only arguments end with `:` in the query
if (argument.endsWith(":")) {
return {
path: `Argument[${argument}]`,
label: `Argument[${argument}]`,
};
}

// Positional-only arguments end with `/` in the query
if (argument.endsWith("/")) {
return {
path: `Argument[${index}]`,
label: `Argument[${index}]: ${argument.substring(0, argument.length - 1)}`,
};
}

// All other arguments are both keyword and positional
return {
path: `Argument[${index}]`,
label: `Argument[${index}]: ${argument}`,
path: `Argument[${index},${argument}:]`,
label: `Argument[${index},${argument}:]: ${argument}`,
};
},
);
Expand Down