update to latest HTML language service

pull/2748/head
Alex Dima 2020-09-07 22:18:53 +02:00
parent 1a46d23399
commit 96feaecfa4
No known key found for this signature in database
GPG Key ID: 6E58D7B045760DA0
4 changed files with 45 additions and 26 deletions

2
.prettierignore 100644
View File

@ -0,0 +1,2 @@
/out/
/release/

44
package-lock.json generated
View File

@ -714,47 +714,47 @@
"dev": true
},
"vscode-html-languageservice": {
"version": "3.0.4-next.12",
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-3.0.4-next.12.tgz",
"integrity": "sha512-/wii3f22RildoI5M6Li2KNMeHTS3xt3ECgQmu5fGkG57rcxzIhO7XlKlozBCG+/NHzWss0lB30c0nfWvIKsn9g==",
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-3.1.2.tgz",
"integrity": "sha512-ixdcyb2xBmwNTuMitT6vNbnvHCnATim1ZZC/CxiUtzKImQjuXAT5Px53x/7+zUqGU9RlfkEwHN//slWcCBMdMw==",
"dev": true,
"requires": {
"vscode-languageserver-textdocument": "^1.0.0-next.5",
"vscode-languageserver-types": "^3.15.0-next.6",
"vscode-nls": "^4.1.1",
"vscode-uri": "^2.1.1"
"vscode-languageserver-textdocument": "^1.0.1",
"vscode-languageserver-types": "3.16.0-next.2",
"vscode-nls": "^4.1.2",
"vscode-uri": "^2.1.2"
},
"dependencies": {
"vscode-languageserver-types": {
"version": "3.15.0-next.9",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.9.tgz",
"integrity": "sha512-Rl/8qJ6932nrHCdPn+9y0x08uLVQaSLRG+U4JzhyKpWU4eJbVaDRoAcz1Llj7CErJGbPr6kdBvShPy5fRfR+Uw==",
"version": "3.16.0-next.2",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.2.tgz",
"integrity": "sha512-QjXB7CKIfFzKbiCJC4OWC8xUncLsxo19FzGVp/ADFvvi87PlmBSCAtZI5xwGjF5qE0xkLf0jjKUn3DzmpDP52Q==",
"dev": true
}
}
},
"vscode-languageserver-textdocument": {
"version": "1.0.0-next.5",
"resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.0-next.5.tgz",
"integrity": "sha512-1jp/zAidN/bF/sqPimhBX1orH5G4rzRw63k75TesukJDuxm8yW79ECStWbDSy41BHGOwSGN4M69QFvhancSr5A==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz",
"integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==",
"dev": true
},
"vscode-languageserver-types": {
"version": "3.15.0-next.9",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.9.tgz",
"integrity": "sha512-Rl/8qJ6932nrHCdPn+9y0x08uLVQaSLRG+U4JzhyKpWU4eJbVaDRoAcz1Llj7CErJGbPr6kdBvShPy5fRfR+Uw==",
"version": "3.15.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz",
"integrity": "sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==",
"dev": true
},
"vscode-nls": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-4.1.1.tgz",
"integrity": "sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A==",
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-4.1.2.tgz",
"integrity": "sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==",
"dev": true
},
"vscode-uri": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.1.tgz",
"integrity": "sha512-eY9jmGoEnVf8VE8xr5znSah7Qt1P/xsCdErz+g8HYZtJ7bZqKH5E3d+6oVNm1AC/c6IHUDokbmVXKOi4qPAC9A==",
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.2.tgz",
"integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==",
"dev": true
},
"which": {

View File

@ -31,9 +31,9 @@
"requirejs": "^2.3.6",
"typescript": "^4.0.2",
"terser": "^5.3.0",
"vscode-html-languageservice": "3.0.4-next.12",
"vscode-languageserver-types": "3.15.0-next.9",
"vscode-languageserver-textdocument": "^1.0.0-next.5"
"vscode-html-languageservice": "3.1.2",
"vscode-languageserver-types": "3.15.1",
"vscode-languageserver-textdocument": "^1.0.1"
},
"husky": {
"hooks": {

View File

@ -17,6 +17,7 @@ import {
MarkerSeverity,
IMarkdownString
} from './fillers/monaco-editor-core';
import { InsertReplaceEdit, TextEdit } from 'vscode-html-languageservice';
export interface WorkerAccessor {
(...more: Uri[]): Promise<HTMLWorker>;
@ -181,6 +182,15 @@ function toRange(range: htmlService.Range): Range {
);
}
function isInsertReplaceEdit(
edit: TextEdit | InsertReplaceEdit
): edit is InsertReplaceEdit {
return (
typeof (<InsertReplaceEdit>edit).insert !== 'undefined' &&
typeof (<InsertReplaceEdit>edit).replace !== 'undefined'
);
}
function toCompletionItemKind(kind: number): languages.CompletionItemKind {
const mItemKind = languages.CompletionItemKind;
@ -326,7 +336,14 @@ export class CompletionAdapter implements languages.CompletionItemProvider {
kind: toCompletionItemKind(entry.kind)
};
if (entry.textEdit) {
item.range = toRange(entry.textEdit.range);
if (isInsertReplaceEdit(entry.textEdit)) {
item.range = {
insert: toRange(entry.textEdit.insert),
replace: toRange(entry.textEdit.replace)
};
} else {
item.range = toRange(entry.textEdit.range);
}
item.insertText = entry.textEdit.newText;
}
if (entry.additionalTextEdits) {