Skip to content

Commit 727ce02

Browse files
committed
fix: restrict semantic tokens and completions to gherkin files
1 parent 300dde4 commit 727ce02

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/CucumberLanguageServer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ export class CucumberLanguageServer {
170170
})
171171
connection.languages.semanticTokens.on((semanticTokenParams) => {
172172
const doc = documents.get(semanticTokenParams.textDocument.uri)
173-
if (!doc) return { data: [] }
173+
const isGherkin = doc?.languageId === 'gherkin' || doc?.languageId === 'cucumber'
174+
if (!doc || !isGherkin) return { data: [] }
174175
const gherkinSource = doc.getText()
175176
return getGherkinSemanticTokens(
176177
gherkinSource,
@@ -186,7 +187,8 @@ export class CucumberLanguageServer {
186187
if (!this.searchIndex) return []
187188

188189
const doc = documents.get(params.textDocument.uri)
189-
if (!doc) return []
190+
const isGherkin = doc?.languageId === 'gherkin' || doc?.languageId === 'cucumber'
191+
if (!doc || !isGherkin) return []
190192
const gherkinSource = doc.getText()
191193
return getGherkinCompletionItems(gherkinSource, params.position, this.searchIndex).slice()
192194
})

0 commit comments

Comments
 (0)