vscode-html-languageservice
Advanced tools
Comparing version 5.1.0 to 5.1.1
@@ -513,3 +513,8 @@ /*--------------------------------------------------------------------------------------------- | ||
if (token === TokenType.EndTagOpen && scanner.getTokenEnd() === offset) { | ||
return `${node.tag}>`; | ||
if (document.getText().charAt(offset) !== '>') { | ||
return `${node.tag}>`; | ||
} | ||
else { | ||
return node.tag; | ||
} | ||
} | ||
@@ -516,0 +521,0 @@ token = scanner.scan(); |
@@ -63,17 +63,21 @@ /*--------------------------------------------------------------------------------------------- | ||
const workspaceUrl = getWorkspaceUrl(document.uri, tokenContent, documentContext, base); | ||
if (!workspaceUrl || !isValidURI(workspaceUrl)) { | ||
if (!workspaceUrl) { | ||
return undefined; | ||
} | ||
const target = validateAndCleanURI(workspaceUrl); | ||
return { | ||
range: Range.create(document.positionAt(startOffset), document.positionAt(endOffset)), | ||
target: workspaceUrl | ||
target | ||
}; | ||
} | ||
function isValidURI(uri) { | ||
function validateAndCleanURI(uriStr) { | ||
try { | ||
Uri.parse(uri); | ||
return true; | ||
const uri = Uri.parse(uriStr); | ||
if (uri.query) { | ||
return uri.with({ query: null }).toString(/* skipEncodig*/ true); | ||
} | ||
return uriStr; | ||
} | ||
catch (e) { | ||
return false; | ||
return undefined; | ||
} | ||
@@ -80,0 +84,0 @@ } |
@@ -525,3 +525,8 @@ /*--------------------------------------------------------------------------------------------- | ||
if (token === htmlLanguageTypes_1.TokenType.EndTagOpen && scanner.getTokenEnd() === offset) { | ||
return `${node.tag}>`; | ||
if (document.getText().charAt(offset) !== '>') { | ||
return `${node.tag}>`; | ||
} | ||
else { | ||
return node.tag; | ||
} | ||
} | ||
@@ -528,0 +533,0 @@ token = scanner.scan(); |
@@ -75,17 +75,21 @@ /*--------------------------------------------------------------------------------------------- | ||
const workspaceUrl = getWorkspaceUrl(document.uri, tokenContent, documentContext, base); | ||
if (!workspaceUrl || !isValidURI(workspaceUrl)) { | ||
if (!workspaceUrl) { | ||
return undefined; | ||
} | ||
const target = validateAndCleanURI(workspaceUrl); | ||
return { | ||
range: htmlLanguageTypes_1.Range.create(document.positionAt(startOffset), document.positionAt(endOffset)), | ||
target: workspaceUrl | ||
target | ||
}; | ||
} | ||
function isValidURI(uri) { | ||
function validateAndCleanURI(uriStr) { | ||
try { | ||
vscode_uri_1.URI.parse(uri); | ||
return true; | ||
const uri = vscode_uri_1.URI.parse(uriStr); | ||
if (uri.query) { | ||
return uri.with({ query: null }).toString(/* skipEncodig*/ true); | ||
} | ||
return uriStr; | ||
} | ||
catch (e) { | ||
return false; | ||
return undefined; | ||
} | ||
@@ -92,0 +96,0 @@ } |
{ | ||
"name": "vscode-html-languageservice", | ||
"version": "5.1.0", | ||
"version": "5.1.1", | ||
"description": "Language service for HTML", | ||
@@ -18,11 +18,11 @@ "main": "./lib/umd/htmlLanguageService.js", | ||
"devDependencies": { | ||
"@types/mocha": "^10.0.1", | ||
"@types/mocha": "^10.0.3", | ||
"@types/node": "16.x", | ||
"@typescript-eslint/eslint-plugin": "^6.6.0", | ||
"@typescript-eslint/parser": "^6.6.0", | ||
"@typescript-eslint/eslint-plugin": "^6.9.0", | ||
"@typescript-eslint/parser": "^6.9.0", | ||
"@vscode/web-custom-data": "^0.4.8", | ||
"eslint": "^8.48.0", | ||
"eslint": "^8.52.0", | ||
"js-beautify": "^1.14.9", | ||
"mocha": "^10.2.0", | ||
"rimraf": "^5.0.1", | ||
"rimraf": "^5.0.5", | ||
"typescript": "^5.2.2" | ||
@@ -32,5 +32,5 @@ }, | ||
"@vscode/l10n": "^0.0.16", | ||
"vscode-languageserver-textdocument": "^1.0.8", | ||
"vscode-languageserver-types": "^3.17.3", | ||
"vscode-uri": "^3.0.7" | ||
"vscode-languageserver-textdocument": "^1.0.11", | ||
"vscode-languageserver-types": "^3.17.5", | ||
"vscode-uri": "^3.0.8" | ||
}, | ||
@@ -37,0 +37,0 @@ "scripts": { |
1576210
33046