mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 22:12:26 +01:00
[json] add trustedDomains settings (#287639)
* use trusted schemas * [json] add trustedDomains settings
This commit is contained in:
committed by
GitHub
parent
4641b2abb8
commit
067cb03d18
@@ -12,7 +12,7 @@
|
||||
"@vscode/l10n": "^0.0.18",
|
||||
"jsonc-parser": "^3.3.1",
|
||||
"request-light": "^0.8.0",
|
||||
"vscode-json-languageservice": "^5.6.4",
|
||||
"vscode-json-languageservice": "^5.7.1",
|
||||
"vscode-languageserver": "^10.0.0-next.15",
|
||||
"vscode-uri": "^3.1.0"
|
||||
},
|
||||
@@ -67,9 +67,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vscode-json-languageservice": {
|
||||
"version": "5.6.4",
|
||||
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-5.6.4.tgz",
|
||||
"integrity": "sha512-i0MhkFmnQAbYr+PiE6Th067qa3rwvvAErCEUo0ql+ghFXHvxbwG3kLbwMaIUrrbCLUDEeULiLgROJjtuyYoIsA==",
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-5.7.1.tgz",
|
||||
"integrity": "sha512-sMK2F8p7St0lJCr/4IfbQRoEUDUZRR7Ud0IiSl8I/JtN+m9Gv+FJlNkSAYns2R7Ebm/PKxqUuWYOfBej/rAdBQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vscode/l10n": "^0.0.18",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"@vscode/l10n": "^0.0.18",
|
||||
"jsonc-parser": "^3.3.1",
|
||||
"request-light": "^0.8.0",
|
||||
"vscode-json-languageservice": "^5.6.4",
|
||||
"vscode-json-languageservice": "^5.7.1",
|
||||
"vscode-languageserver": "^10.0.0-next.15",
|
||||
"vscode-uri": "^3.1.0"
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import {
|
||||
Connection,
|
||||
TextDocuments, InitializeParams, InitializeResult, NotificationType, RequestType,
|
||||
TextDocuments, InitializeParams, InitializeResult, NotificationType, RequestType, ResponseError,
|
||||
DocumentRangeFormattingRequest, Disposable, ServerCapabilities, TextDocumentSyncKind, TextEdit, DocumentFormattingRequest, TextDocumentIdentifier, FormattingOptions, Diagnostic, CodeAction, CodeActionKind
|
||||
} from 'vscode-languageserver';
|
||||
|
||||
@@ -36,6 +36,10 @@ namespace ForceValidateRequest {
|
||||
export const type: RequestType<string, Diagnostic[], any> = new RequestType('json/validate');
|
||||
}
|
||||
|
||||
namespace ForceValidateAllRequest {
|
||||
export const type: RequestType<void, void, any> = new RequestType('json/validateAll');
|
||||
}
|
||||
|
||||
namespace LanguageStatusRequest {
|
||||
export const type: RequestType<string, JSONLanguageStatus, any> = new RequestType('json/languageStatus');
|
||||
}
|
||||
@@ -102,8 +106,8 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
||||
}
|
||||
return connection.sendRequest(VSCodeContentRequest.type, uri).then(responseText => {
|
||||
return responseText;
|
||||
}, error => {
|
||||
return Promise.reject(error.message);
|
||||
}, (error: ResponseError<any>) => {
|
||||
return Promise.reject(error);
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -298,6 +302,10 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
||||
});
|
||||
|
||||
// Retry schema validation on all open documents
|
||||
connection.onRequest(ForceValidateAllRequest.type, async () => {
|
||||
diagnosticsSupport?.requestRefresh();
|
||||
});
|
||||
|
||||
connection.onRequest(ForceValidateRequest.type, async uri => {
|
||||
const document = documents.get(uri);
|
||||
if (document) {
|
||||
@@ -387,11 +395,11 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
||||
connection.onDidChangeWatchedFiles((change) => {
|
||||
// Monitored files have changed in VSCode
|
||||
let hasChanges = false;
|
||||
change.changes.forEach(c => {
|
||||
for (const c of change.changes) {
|
||||
if (languageService.resetSchema(c.uri)) {
|
||||
hasChanges = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (hasChanges) {
|
||||
diagnosticsSupport?.requestRefresh();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user