Skip to content

Commit 5a40898

Browse files
committed
chore: Addressing comments.
1 parent a5123fc commit 5a40898

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

packages/@css-blocks/core/src/configuration/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export interface Configuration {
2020
preprocessors: Preprocessors;
2121

2222
/**
23-
* An importer is an object that is in charge of finding the path to the block
24-
* file from it's @block directive
23+
* An importer is an object that is in charge of finding the contents of a
24+
* block file from its @block directive
2525
*/
2626
importer: Importer;
2727

packages/@css-blocks/language-server/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
"posttest": "yarn run lint",
3333
"test": "mocha dist/test --opts src/test/mocha.opts",
3434
"test:runner": "mocha dist/test",
35-
"watch": "watch 'yarn run compile' './src' --wait=3"
35+
"watch": "watch 'yarn run test' './src' --wait=3"
3636
}
3737
}

packages/@css-blocks/language-server/src/Importer.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { NodeJsImporter } from "@css-blocks/core/dist/src";
1+
import { NodeJsImporter, Configuration, ImportedFile } from "@css-blocks/core";
22
import { TextDocuments } from "vscode-languageserver";
3+
import { URI } from "vscode-uri";
34

45
/**
56
* Imports the contents of the file from the language server client if its
@@ -13,9 +14,9 @@ export class LSImporter extends NodeJsImporter {
1314
this.documents = documents;
1415
}
1516

16-
async import(identifier: string, config: Readonly<import("@css-blocks/core/dist/src").Configuration>): Promise<import("@css-blocks/core/dist/src").ImportedFile> {
17+
async import(identifier: string, config: Configuration): Promise<ImportedFile> {
1718
// the uri expected is that of a file
18-
let clientDocument = this.documents.get(`file://${identifier}`);
19+
let clientDocument = this.documents.get(URI.file(identifier).toString());
1920
// if the document is opened on the client, read from there
2021
// this will allow us to access the contents of an unsaved file
2122
if (clientDocument) {

packages/@css-blocks/language-server/src/eventHandlers/documentContentChange.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ export async function documentContentChange(e: TextDocumentChangeEvent, blockFac
1515
// the block file is opened
1616
await blockFactory.getBlockFromPath(URI.parse(uri).fsPath);
1717
} catch (error) {
18-
if (error instanceof CssBlockError) {
19-
errors = errors.concat(error);
20-
}
21-
return errors;
18+
return error instanceof CssBlockError ? [error] : [];
2219
}
2320
}
2421
return [];

0 commit comments

Comments
 (0)