From d0c17a67f4cb3fcf04b181070cb9d7aa9e3372e6 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Sat, 13 Jul 2024 13:21:24 +0200 Subject: [PATCH] Avoid tool_id completion whith slashes For now just try to search for tool ids without parsing possible additional toolsheds or repositories. --- .../src/services/completionService.ts | 2 +- .../tests/integration/completion.test.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/server/gx-workflow-ls-format2/src/services/completionService.ts b/server/gx-workflow-ls-format2/src/services/completionService.ts index bc2c53e..fdbbad2 100644 --- a/server/gx-workflow-ls-format2/src/services/completionService.ts +++ b/server/gx-workflow-ls-format2/src/services/completionService.ts @@ -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); diff --git a/server/gx-workflow-ls-format2/tests/integration/completion.test.ts b/server/gx-workflow-ls-format2/tests/integration/completion.test.ts index 1db1d6d..2f6f1a6 100644 --- a/server/gx-workflow-ls-format2/tests/integration/completion.test.ts +++ b/server/gx-workflow-ls-format2/tests/integration/completion.test.ts @@ -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); + }); });