From 727ce02873ab1e7b963c9e6f2af244342417df1c Mon Sep 17 00:00:00 2001 From: zohnannor Date: Sun, 5 Apr 2026 17:59:29 +0300 Subject: [PATCH] fix: restrict semantic tokens and completions to gherkin files --- src/CucumberLanguageServer.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/CucumberLanguageServer.ts b/src/CucumberLanguageServer.ts index de6f0659..6118eeb1 100644 --- a/src/CucumberLanguageServer.ts +++ b/src/CucumberLanguageServer.ts @@ -170,7 +170,8 @@ export class CucumberLanguageServer { }) connection.languages.semanticTokens.on((semanticTokenParams) => { const doc = documents.get(semanticTokenParams.textDocument.uri) - if (!doc) return { data: [] } + const isGherkin = doc?.languageId === 'gherkin' || doc?.languageId === 'cucumber' + if (!doc || !isGherkin) return { data: [] } const gherkinSource = doc.getText() return getGherkinSemanticTokens( gherkinSource, @@ -186,7 +187,8 @@ export class CucumberLanguageServer { if (!this.searchIndex) return [] const doc = documents.get(params.textDocument.uri) - if (!doc) return [] + const isGherkin = doc?.languageId === 'gherkin' || doc?.languageId === 'cucumber' + if (!doc || !isGherkin) return [] const gherkinSource = doc.getText() return getGherkinCompletionItems(gherkinSource, params.position, this.searchIndex).slice() })