vscode-vue-languageservice
Advanced tools
Comparing version 0.28.9 to 0.28.10
@@ -119,3 +119,3 @@ "use strict"; | ||
let lastScriptProjectVersionWhenTemplateProjectVersionUpdate = -1; | ||
const documents = new shared.UriMap(); | ||
const documents = shared.createPathMap(); | ||
const sourceFiles = (0, sourceFiles_1.createSourceFiles)(); | ||
@@ -552,3 +552,3 @@ const templateScriptUpdateUris = new Set(); | ||
const version = Number(vueHost.getScriptVersion(fileName)); | ||
if (!documents.has(uri) || documents.get(uri).version !== version) { | ||
if (!documents.uriHas(uri) || documents.uriGet(uri).version !== version) { | ||
const scriptSnapshot = vueHost.getScriptSnapshot(fileName); | ||
@@ -558,7 +558,7 @@ if (scriptSnapshot) { | ||
const document = vscode_languageserver_textdocument_1.TextDocument.create(uri, uri.endsWith('.vue') ? 'vue' : 'typescript', version, scriptText); | ||
documents.set(uri, document); | ||
documents.uriSet(uri, document); | ||
} | ||
} | ||
if (documents.has(uri)) { | ||
return documents.get(uri); | ||
if (documents.uriHas(uri)) { | ||
return documents.uriGet(uri); | ||
} | ||
@@ -565,0 +565,0 @@ } |
@@ -401,3 +401,3 @@ "use strict"; | ||
const documentation = typeof vueItem.documentation === 'string' ? vueItem.documentation : (_b = vueItem.documentation) === null || _b === void 0 ? void 0 : _b.value; | ||
const importFile = documentation ? sourceFiles.get(documentation) : undefined; | ||
const importFile = (documentation === null || documentation === void 0 ? void 0 : documentation.startsWith('file://')) ? sourceFiles.get(documentation) : undefined; | ||
if (importFile) { | ||
@@ -460,6 +460,10 @@ const filePath = shared.uriToFsPath(importFile.uri); | ||
} | ||
{ // filter HTMLAttributes | ||
{ | ||
const temp = new Map(); | ||
for (const item of vueItems) { | ||
if (!((_c = temp.get(item.label)) === null || _c === void 0 ? void 0 : _c.documentation)) { | ||
const data = item.data; | ||
if ((data === null || data === void 0 ? void 0 : data.mode) === 'autoImport' && data.importUri === sourceFile.uri) { // don't import itself | ||
continue; | ||
} | ||
if (!((_c = temp.get(item.label)) === null || _c === void 0 ? void 0 : _c.documentation)) { // filter HTMLAttributes | ||
temp.set(item.label, item); | ||
@@ -466,0 +470,0 @@ } |
@@ -126,9 +126,21 @@ "use strict"; | ||
if (exportDefault.componentsOption && exportDefault.componentsOptionNode) { | ||
exportDefault.componentsOptionNode.properties.push(ts.factory.createShorthandPropertyAssignment(componentName)); | ||
const printText = printer.printNode(ts.EmitHint.Expression, exportDefault.componentsOptionNode, scriptAst); | ||
const newNode = { | ||
...exportDefault.componentsOptionNode, | ||
properties: [ | ||
...exportDefault.componentsOptionNode.properties, | ||
ts.factory.createShorthandPropertyAssignment(componentName), | ||
], | ||
}; | ||
const printText = printer.printNode(ts.EmitHint.Expression, newNode, scriptAst); | ||
vueItem.additionalTextEdits.push(vscode.TextEdit.replace(vscode.Range.create(textDoc.positionAt(descriptor.script.startTagEnd + exportDefault.componentsOption.start), textDoc.positionAt(descriptor.script.startTagEnd + exportDefault.componentsOption.end)), unescape(printText.replace(/\\u/g, '%u')))); | ||
} | ||
else if (exportDefault.args && exportDefault.argsNode) { | ||
exportDefault.argsNode.properties.push(ts.factory.createShorthandPropertyAssignment(`components: { ${componentName} }`)); | ||
const printText = printer.printNode(ts.EmitHint.Expression, exportDefault.argsNode, scriptAst); | ||
const newNode = { | ||
...exportDefault.argsNode, | ||
properties: [ | ||
...exportDefault.argsNode.properties, | ||
ts.factory.createShorthandPropertyAssignment(`components: { ${componentName} }`), | ||
], | ||
}; | ||
const printText = printer.printNode(ts.EmitHint.Expression, newNode, scriptAst); | ||
vueItem.additionalTextEdits.push(vscode.TextEdit.replace(vscode.Range.create(textDoc.positionAt(descriptor.script.startTagEnd + exportDefault.args.start), textDoc.positionAt(descriptor.script.startTagEnd + exportDefault.args.end)), unescape(printText.replace(/\\u/g, '%u')))); | ||
@@ -135,0 +147,0 @@ } |
@@ -91,5 +91,3 @@ "use strict"; | ||
const indent_2 = lineIndents[j]; | ||
if (indent_2 === undefined) | ||
continue; | ||
if (indent_2.length <= indent.length) { | ||
if (indent_2 === undefined || indent_2.length <= indent.length) { | ||
const endPos = sourceMap.mappedDocument.positionAt(offset_2); | ||
@@ -96,0 +94,0 @@ const foldingRange = vscode.FoldingRange.create(startPos.line, endPos.line - 1, undefined, undefined, kind); |
@@ -10,9 +10,22 @@ "use strict"; | ||
function createSourceFiles() { | ||
const sourceFiles = (0, reactivity_1.shallowReactive)({}); | ||
const all = (0, reactivity_1.computed)(() => Object.values(sourceFiles)); | ||
const _sourceFiles = (0, reactivity_1.shallowReactive)({}); | ||
const sourceFiles = shared.createPathMap({ | ||
delete: key => delete _sourceFiles[key], | ||
get: key => _sourceFiles[key], | ||
has: key => !!_sourceFiles[key], | ||
set: (key, value) => _sourceFiles[key] = value, | ||
clear: () => { | ||
for (var key in _sourceFiles) { | ||
if (_sourceFiles.hasOwnProperty(key)) { | ||
delete _sourceFiles[key]; | ||
} | ||
} | ||
}, | ||
}); | ||
const all = (0, reactivity_1.computed)(() => Object.values(_sourceFiles)); | ||
const uris = (0, reactivity_1.computed)(() => all.value.map(sourceFile => sourceFile.uri)); | ||
const cssSourceMaps = (0, reactivity_1.computed)(() => { | ||
const map = new Map(); | ||
for (const key in sourceFiles) { | ||
const sourceFile = sourceFiles[key]; | ||
for (const key in _sourceFiles) { | ||
const sourceFile = _sourceFiles[key]; | ||
for (const sourceMap of sourceFile.refs.cssLsSourceMaps.value) { | ||
@@ -26,4 +39,4 @@ map.set(sourceMap.mappedDocument.uri, sourceMap); | ||
const map = new Map(); | ||
for (const key in sourceFiles) { | ||
const sourceFile = sourceFiles[key]; | ||
for (const key in _sourceFiles) { | ||
const sourceFile = _sourceFiles[key]; | ||
if (sourceFile.refs.sfcTemplate.htmlSourceMap.value) { | ||
@@ -40,4 +53,4 @@ const sourceMap = sourceFile.refs.sfcTemplate.htmlSourceMap.value; | ||
const map = new Map(); | ||
for (const key in sourceFiles) { | ||
const sourceFile = sourceFiles[key]; | ||
for (const key in _sourceFiles) { | ||
const sourceFile = _sourceFiles[key]; | ||
for (const tsDoc of sourceFile.refs.templateLsDocuments.value) { | ||
@@ -51,4 +64,4 @@ map.set(tsDoc.uri, tsDoc); | ||
const map = new Map(); | ||
for (const key in sourceFiles) { | ||
const sourceFile = sourceFiles[key]; | ||
for (const key in _sourceFiles) { | ||
const sourceFile = _sourceFiles[key]; | ||
for (const sourceMap of sourceFile.refs.templateLsTeleports.value) { | ||
@@ -62,4 +75,4 @@ map.set(sourceMap.mappedDocument.uri, sourceMap); | ||
const map = new Map(); | ||
for (const key in sourceFiles) { | ||
const sourceFile = sourceFiles[key]; | ||
for (const key in _sourceFiles) { | ||
const sourceFile = _sourceFiles[key]; | ||
for (const sourceMap of sourceFile.refs.templateLsSourceMaps.value) { | ||
@@ -73,4 +86,4 @@ map.set(sourceMap.mappedDocument.uri, sourceMap); | ||
const map = new Map(); | ||
for (const key in sourceFiles) { | ||
const sourceFile = sourceFiles[key]; | ||
for (const key in _sourceFiles) { | ||
const sourceFile = _sourceFiles[key]; | ||
for (const tsDoc of sourceFile.refs.templateLsDocuments.value) { | ||
@@ -86,4 +99,4 @@ map.set(tsDoc.uri, sourceFile); | ||
const map = new Map(); | ||
for (const key in sourceFiles) { | ||
const sourceFile = sourceFiles[key]; | ||
for (const key in _sourceFiles) { | ||
const sourceFile = _sourceFiles[key]; | ||
for (const tsDoc of sourceFile.refs.scriptLsDocuments.value) { | ||
@@ -97,4 +110,4 @@ map.set(tsDoc.uri, tsDoc); | ||
const map = new Map(); | ||
for (const key in sourceFiles) { | ||
const sourceFile = sourceFiles[key]; | ||
for (const key in _sourceFiles) { | ||
const sourceFile = _sourceFiles[key]; | ||
const sourceMap = sourceFile.refs.sfcScriptForScriptLs.teleportSourceMap.value; | ||
@@ -107,4 +120,4 @@ map.set(sourceMap.mappedDocument.uri, sourceMap); | ||
const map = new Map(); | ||
for (const key in sourceFiles) { | ||
const sourceFile = sourceFiles[key]; | ||
for (const key in _sourceFiles) { | ||
const sourceFile = _sourceFiles[key]; | ||
for (const sourceMap of sourceFile.refs.scriptLsSourceMaps.value) { | ||
@@ -118,4 +131,4 @@ map.set(sourceMap.mappedDocument.uri, sourceMap); | ||
const map = new Map(); | ||
for (const key in sourceFiles) { | ||
const sourceFile = sourceFiles[key]; | ||
for (const key in _sourceFiles) { | ||
const sourceFile = _sourceFiles[key]; | ||
for (const tsDoc of sourceFile.refs.scriptLsDocuments.value) { | ||
@@ -134,11 +147,5 @@ map.set(tsDoc.uri, sourceFile); | ||
getAll: (0, untrack_1.untrack)(() => all.value), | ||
get: (0, untrack_1.untrack)((uri) => sourceFiles[uri.toLowerCase()]), | ||
set: (0, untrack_1.untrack)((uri, sourceFile) => sourceFiles[uri.toLowerCase()] = sourceFile), | ||
delete: (0, untrack_1.untrack)((uri) => { | ||
if (sourceFiles[uri.toLowerCase()]) { | ||
delete sourceFiles[uri.toLowerCase()]; | ||
return true; | ||
} | ||
return false; | ||
}), | ||
get: (0, untrack_1.untrack)(sourceFiles.uriGet), | ||
set: (0, untrack_1.untrack)(sourceFiles.uriSet), | ||
delete: (0, untrack_1.untrack)(sourceFiles.uriDelete), | ||
getTsTeleports: (0, untrack_1.untrack)((lsType) => tsRefs[lsType].teleports.value), | ||
@@ -154,3 +161,3 @@ getTsDocuments: (0, untrack_1.untrack)((lsType) => tsRefs[lsType].documents.value), | ||
for (const lsType of ['script', 'template']) { | ||
const sourceFile = sourceFiles[uri.toLowerCase()]; | ||
const sourceFile = sourceFiles.uriGet(uri); | ||
if (sourceFile) { | ||
@@ -157,0 +164,0 @@ for (const sourceMap of lsType === 'script' ? sourceFile.refs.scriptLsSourceMaps.value : sourceFile.refs.templateLsSourceMaps.value) { |
{ | ||
"name": "vscode-vue-languageservice", | ||
"version": "0.28.9", | ||
"version": "0.28.10", | ||
"main": "out/index.js", | ||
@@ -19,7 +19,7 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/code-gen": "0.28.9", | ||
"@volar/html2pug": "0.28.9", | ||
"@volar/shared": "0.28.9", | ||
"@volar/source-map": "0.28.9", | ||
"@volar/transforms": "0.28.9", | ||
"@volar/code-gen": "0.28.10", | ||
"@volar/html2pug": "0.28.10", | ||
"@volar/shared": "0.28.10", | ||
"@volar/source-map": "0.28.10", | ||
"@volar/transforms": "0.28.10", | ||
"@vscode/emmet-helper": "^2.8.0", | ||
@@ -36,6 +36,6 @@ "@vue/compiler-dom": "^3.2.20", | ||
"vscode-languageserver-textdocument": "^1.0.1", | ||
"vscode-pug-languageservice": "0.28.9", | ||
"vscode-typescript-languageservice": "0.28.9" | ||
"vscode-pug-languageservice": "0.28.10", | ||
"vscode-typescript-languageservice": "0.28.10" | ||
}, | ||
"gitHead": "ed014c79bb485d95444f81d967cd095b4e0d88a6" | ||
"gitHead": "2b49fd7084e5be2a763cbc50f2f17e82f6d1a084" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
743450
15384
+ Added@volar/code-gen@0.28.10(transitive)
+ Added@volar/html2pug@0.28.10(transitive)
+ Added@volar/shared@0.28.10(transitive)
+ Added@volar/source-map@0.28.10(transitive)
+ Added@volar/transforms@0.28.10(transitive)
+ Addedvscode-pug-languageservice@0.28.10(transitive)
+ Addedvscode-typescript-languageservice@0.28.10(transitive)
- Removed@volar/code-gen@0.28.9(transitive)
- Removed@volar/html2pug@0.28.9(transitive)
- Removed@volar/shared@0.28.9(transitive)
- Removed@volar/source-map@0.28.9(transitive)
- Removed@volar/transforms@0.28.9(transitive)
- Removedvscode-pug-languageservice@0.28.9(transitive)
- Removedvscode-typescript-languageservice@0.28.9(transitive)
Updated@volar/code-gen@0.28.10
Updated@volar/html2pug@0.28.10
Updated@volar/shared@0.28.10
Updated@volar/source-map@0.28.10
Updated@volar/transforms@0.28.10