diff --git a/packages/language-services/src/features/__tests__/code-actions-extract.test.ts b/packages/language-services/src/features/__tests__/code-actions-extract.test.ts index 2393adf0..6734d17d 100644 --- a/packages/language-services/src/features/__tests__/code-actions-extract.test.ts +++ b/packages/language-services/src/features/__tests__/code-actions-extract.test.ts @@ -32,7 +32,10 @@ const getEdit = (result: CodeAction): TextEdit[] => { }; test("extraction for variable", async () => { - const document = fileSystemProvider.createDocument("--var: black;"); + const document = fileSystemProvider.createDocument([ + "--var: black;", + ".a { color: var(--var); }", + ]); const result = await ls.getCodeActions( document, diff --git a/packages/language-services/src/utils/test-helpers.ts b/packages/language-services/src/utils/test-helpers.ts index 7c765234..aa9d7c3d 100644 --- a/packages/language-services/src/utils/test-helpers.ts +++ b/packages/language-services/src/utils/test-helpers.ts @@ -1,3 +1,4 @@ +import { EOL } from "node:os"; import { join } from "path"; import { LanguageServiceOptions, @@ -19,7 +20,7 @@ class MemoryFileSystem implements FileSystemProvider { lines: string[] | string, options: { uri?: string; languageId?: string; version?: number } = {}, ): TextDocument { - const text = Array.isArray(lines) ? lines.join("\n") : lines; + const text = Array.isArray(lines) ? lines.join(EOL) : lines; const uri = URI.file(join(process.cwd(), options.uri || "index.scss")); const document = TextDocument.create( uri.toString(),