Skip to content

Commit

Permalink
Avoid tool_id completion whith slashes
Browse files Browse the repository at this point in the history
For now just try to search for tool ids without parsing possible additional toolsheds or repositories.
  • Loading branch information
davelopez committed Jul 13, 2024
1 parent 148d98a commit d0c17a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class GxFormat2CompletionService {
return result;
}
if (schemaNode.name === "tool_id") {
if (currentWord) {
if (currentWord && !currentWord.includes("/")) {
const tools = await this.toolshedService.searchToolsById(currentWord);
for (const tool of tools) {
const item: CompletionItem = this.buildCompletionItemFromTool(tool, overwriteRange);
Expand Down
13 changes: 13 additions & 0 deletions server/gx-workflow-ls-format2/tests/integration/completion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,4 +413,17 @@ steps:

expect(completions?.items).toHaveLength(0);
});

it("should not suggest toolshed tools when the cursor is inside the `tool_id` property and the current word contains slashes", async () => {
const template = `
class: GalaxyWorkflow
steps:
my_step:
tool_id: toolshed/owner/repo/tool$`;
const { contents, position } = parseTemplate(template);

const completions = await getCompletions(contents, position);

expect(completions?.items).toHaveLength(0);
});
});

0 comments on commit d0c17a6

Please sign in to comment.