cspell-lib 6.2.0 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -60,5 +60,6 @@ export interface TextDocumentContentChangeEvent {
|
|
|
60
60
|
}
|
|
61
61
|
export declare function createTextDocument({ uri, content, languageId, locale, version, }: CreateTextDocumentParams): TextDocument;
|
|
62
62
|
export declare function updateTextDocument(doc: TextDocument, edits: TextDocumentContentChangeEvent[], version?: number): TextDocument;
|
|
63
|
+
export declare function loadTextDocument(filename: string | DocumentUri, languageId?: string): Promise<TextDocument>;
|
|
63
64
|
export declare const isTextDocument: (doc: TextDocument | unknown) => doc is TextDocument;
|
|
64
65
|
//# sourceMappingURL=TextDocument.d.ts.map
|
|
@@ -26,11 +26,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.isTextDocument = exports.updateTextDocument = exports.createTextDocument = void 0;
|
|
29
|
+
exports.isTextDocument = exports.loadTextDocument = exports.updateTextDocument = exports.createTextDocument = void 0;
|
|
30
30
|
const LanguageIds_1 = require("../LanguageIds");
|
|
31
31
|
const Uri = __importStar(require("./Uri"));
|
|
32
32
|
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
33
33
|
const assert_1 = __importDefault(require("assert"));
|
|
34
|
+
const fs_1 = require("fs");
|
|
34
35
|
class TextDocumentImpl {
|
|
35
36
|
constructor(uri, text, languageId, locale, version) {
|
|
36
37
|
this.uri = uri;
|
|
@@ -127,5 +128,11 @@ exports.updateTextDocument = updateTextDocument;
|
|
|
127
128
|
function isTextDocumentImpl(doc) {
|
|
128
129
|
return doc instanceof TextDocumentImpl;
|
|
129
130
|
}
|
|
131
|
+
async function loadTextDocument(filename, languageId) {
|
|
132
|
+
const uri = Uri.toUri(filename);
|
|
133
|
+
const content = await fs_1.promises.readFile(uri.fsPath, 'utf8');
|
|
134
|
+
return createTextDocument({ uri, languageId, content });
|
|
135
|
+
}
|
|
136
|
+
exports.loadTextDocument = loadTextDocument;
|
|
130
137
|
exports.isTextDocument = isTextDocumentImpl;
|
|
131
138
|
//# sourceMappingURL=TextDocument.js.map
|
|
@@ -67,9 +67,6 @@ function mapDictDefsToInternal(defs, pathToSettingsFile) {
|
|
|
67
67
|
exports.mapDictDefsToInternal = mapDictDefsToInternal;
|
|
68
68
|
function mapDictDefToInternal(def, pathToSettingsFile) {
|
|
69
69
|
if (isDictionaryDefinitionWithSource(def)) {
|
|
70
|
-
if (def.__source !== pathToSettingsFile) {
|
|
71
|
-
throw new Error('Trying to normalize a dictionary definition with a different source.');
|
|
72
|
-
}
|
|
73
70
|
return def;
|
|
74
71
|
}
|
|
75
72
|
return new _DictionaryDefinitionInternalWithSource(def, pathToSettingsFile);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell-lib",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"description": "A library of useful functions used across various cspell tools.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/streetsidesoftware/cspell#readme",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@cspell/cspell-bundled-dicts": "^6.2.
|
|
51
|
+
"@cspell/cspell-bundled-dicts": "^6.2.1",
|
|
52
52
|
"@cspell/cspell-pipe": "^6.2.0",
|
|
53
53
|
"@cspell/cspell-types": "^6.2.0",
|
|
54
54
|
"clear-module": "^4.1.2",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"cosmiconfig": "^7.0.1",
|
|
58
58
|
"cspell-glob": "^6.2.0",
|
|
59
59
|
"cspell-io": "^6.2.0",
|
|
60
|
-
"cspell-trie-lib": "^6.2.
|
|
60
|
+
"cspell-trie-lib": "^6.2.1",
|
|
61
61
|
"fast-equals": "^4.0.1",
|
|
62
62
|
"find-up": "^5.0.0",
|
|
63
63
|
"fs-extra": "^10.1.0",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"rollup-plugin-dts": "^4.2.2",
|
|
93
93
|
"ts-jest": "^28.0.5"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "16349d3df44ef6239d043fe5c8f8c47e36de4251"
|
|
96
96
|
}
|