@volar/monaco 2.0.4 → 2.1.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.
- package/lib/ata.js +5 -5
- package/lib/provider.js +2 -1
- package/package.json +5 -5
- package/worker.js +1 -1
package/lib/ata.js
CHANGED
|
@@ -32,21 +32,21 @@ export function activateAutomaticTypeAcquisition(env, onFetch) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
if (fileName.startsWith('/node_modules/')) {
|
|
35
|
-
const path =
|
|
35
|
+
const path = fileName.substring('/node_modules/'.length);
|
|
36
36
|
return await _stat(path);
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
async readFile(uri) {
|
|
40
40
|
const fileName = env.typescript.uriToFileName(uri);
|
|
41
41
|
if (fileName.startsWith('/node_modules/')) {
|
|
42
|
-
const path =
|
|
42
|
+
const path = fileName.substring('/node_modules/'.length);
|
|
43
43
|
return await _readFile(path);
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
async readDirectory(uri) {
|
|
47
47
|
const fileName = env.typescript.uriToFileName(uri);
|
|
48
48
|
if (fileName.startsWith('/node_modules/')) {
|
|
49
|
-
const path =
|
|
49
|
+
const path = fileName.substring('/node_modules/'.length);
|
|
50
50
|
return _readDirectory(path);
|
|
51
51
|
}
|
|
52
52
|
return [];
|
|
@@ -185,10 +185,10 @@ export function activateAutomaticTypeAcquisition(env, onFetch) {
|
|
|
185
185
|
const parts = path.split('/');
|
|
186
186
|
let pkgName = parts[0];
|
|
187
187
|
if (pkgName.startsWith('@')) {
|
|
188
|
-
if (
|
|
188
|
+
if (!parts[1]) {
|
|
189
189
|
return undefined;
|
|
190
190
|
}
|
|
191
|
-
pkgName += '/' + parts[
|
|
191
|
+
pkgName += '/' + parts[1];
|
|
192
192
|
}
|
|
193
193
|
return pkgName;
|
|
194
194
|
}
|
package/lib/provider.js
CHANGED
|
@@ -184,9 +184,10 @@ export async function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
184
184
|
async provideCompletionItems(model, position, context) {
|
|
185
185
|
const languageService = await worker.withSyncedResources(getSyncUris());
|
|
186
186
|
const codeResult = await languageService.doComplete(model.uri.toString(), fromPosition(position), fromCompletionContext(context));
|
|
187
|
+
const wordInfo = model.getWordUntilPosition(position);
|
|
187
188
|
const monacoResult = toCompletionList(codeResult, {
|
|
188
189
|
range: {
|
|
189
|
-
startColumn:
|
|
190
|
+
startColumn: wordInfo.startColumn,
|
|
190
191
|
startLineNumber: position.lineNumber,
|
|
191
192
|
endColumn: position.column,
|
|
192
193
|
endLineNumber: position.lineNumber,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/monaco",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"directory": "packages/monaco"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/language-service": "2.
|
|
17
|
-
"@volar/typescript": "2.
|
|
18
|
-
"monaco-languageserver-types": "^0.3.
|
|
16
|
+
"@volar/language-service": "2.1.1",
|
|
17
|
+
"@volar/typescript": "2.1.1",
|
|
18
|
+
"monaco-languageserver-types": "^0.3.3",
|
|
19
19
|
"monaco-types": "^0.1.0",
|
|
20
20
|
"vscode-uri": "^3.0.8"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"monaco-editor-core": "latest"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "e56916097fe7be2920aab6592a564a8e2ceafd14"
|
|
26
26
|
}
|
package/worker.js
CHANGED
|
@@ -30,6 +30,7 @@ export function createTypeScriptWorkerService({ typescript: ts, compilerOptions,
|
|
|
30
30
|
let projectVersion = 0;
|
|
31
31
|
const modelSnapshot = new WeakMap();
|
|
32
32
|
const modelVersions = new Map();
|
|
33
|
+
const sys = createSys(ts, env, env.typescript.uriToFileName(env.workspaceFolder));
|
|
33
34
|
const host = {
|
|
34
35
|
getCurrentDirectory() {
|
|
35
36
|
return env.typescript.uriToFileName(env.workspaceFolder);
|
|
@@ -73,7 +74,6 @@ export function createTypeScriptWorkerService({ typescript: ts, compilerOptions,
|
|
|
73
74
|
},
|
|
74
75
|
getLanguageId: id => resolveCommonLanguageId(id),
|
|
75
76
|
};
|
|
76
|
-
const sys = createSys(ts, env, host);
|
|
77
77
|
const languageContext = createLanguage(ts, sys, languagePlugins, undefined, host, {
|
|
78
78
|
fileNameToFileId: env.typescript.fileNameToUri,
|
|
79
79
|
fileIdToFileName: env.typescript.uriToFileName,
|