@codingame/monaco-vscode-json-language-features-default-extension 1.82.5 → 1.83.0-next.0
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/index.js +1 -1
- package/jsonClientMain.js +3 -21
- package/jsonClientMain.js.map +1 -1
- package/jsonServerMain.js +18 -2
- package/jsonServerMain.js.map +1 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { registerExtension } from 'vscode/extensions';
|
|
2
2
|
|
|
3
|
-
var manifest = {name:"json-language-features",displayName:"JSON Language Features",description:"Provides rich language support for JSON files.",version:"1.0.0",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.77.0"},enabledApiProposals:[],icon:"icons/json.png",activationEvents:["onLanguage:json","onLanguage:jsonc"],main:undefined,browser:"./client/dist/browser/jsonClientMain",capabilities:{virtualWorkspaces:true,untrustedWorkspaces:{supported:true}},scripts:{compile:"npx gulp compile-extension:json-language-features-client compile-extension:json-language-features-server",watch:"npx gulp watch-extension:json-language-features-client watch-extension:json-language-features-server","install-client-next":"yarn add vscode-languageclient@next"},categories:["Programming Languages"],contributes:{configuration:{id:"json",order:20,type:"object",title:"JSON",properties:{"json.schemas":{type:"array",scope:"resource",description:"Associate schemas to JSON files in the current project.",items:{type:"object","default":{fileMatch:["/myfile"],url:"schemaURL"},properties:{url:{type:"string","default":"/user.schema.json",description:"A URL or absolute file path to a schema. Can be a relative path in workspace and workspace folder settings."},fileMatch:{type:"array",items:{type:"string","default":"MyFile.json",description:"A file pattern that can contain '*' and '**' to match against when resolving JSON files to schemas. When beginning with '!', it defines an exclusion pattern."},minItems:1,description:"An array of file patterns to match against when resolving JSON files to schemas. `*` and '**' can be used as a wildcard. Exclusion patterns can also be defined and start with '!'. A file matches when there is at least one matching pattern and the last matching pattern is not an exclusion pattern."},schema:{$ref:"http://json-schema.org/draft-07/schema#",description:"The schema definition for the given URL. The schema only needs to be provided to avoid accesses to the schema URL."}}}},"json.validate.enable":{type:"boolean",scope:"window","default":true,description:"Enable/disable JSON validation."},"json.format.enable":{type:"boolean",scope:"window","default":true,description:"Enable/disable default JSON formatter"},"json.format.keepLines":{type:"boolean",scope:"window","default":false,description:"Keep all existing new lines when formatting."},"json.
|
|
3
|
+
var manifest = {name:"json-language-features",displayName:"JSON Language Features",description:"Provides rich language support for JSON files.",version:"1.0.0",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.77.0"},enabledApiProposals:[],icon:"icons/json.png",activationEvents:["onLanguage:json","onLanguage:jsonc"],main:undefined,browser:"./client/dist/browser/jsonClientMain",capabilities:{virtualWorkspaces:true,untrustedWorkspaces:{supported:true}},scripts:{compile:"npx gulp compile-extension:json-language-features-client compile-extension:json-language-features-server",watch:"npx gulp watch-extension:json-language-features-client watch-extension:json-language-features-server","install-client-next":"yarn add vscode-languageclient@next"},categories:["Programming Languages"],contributes:{configuration:{id:"json",order:20,type:"object",title:"JSON",properties:{"json.schemas":{type:"array",scope:"resource",description:"Associate schemas to JSON files in the current project.",items:{type:"object","default":{fileMatch:["/myfile"],url:"schemaURL"},properties:{url:{type:"string","default":"/user.schema.json",description:"A URL or absolute file path to a schema. Can be a relative path in workspace and workspace folder settings."},fileMatch:{type:"array",items:{type:"string","default":"MyFile.json",description:"A file pattern that can contain '*' and '**' to match against when resolving JSON files to schemas. When beginning with '!', it defines an exclusion pattern."},minItems:1,description:"An array of file patterns to match against when resolving JSON files to schemas. `*` and '**' can be used as a wildcard. Exclusion patterns can also be defined and start with '!'. A file matches when there is at least one matching pattern and the last matching pattern is not an exclusion pattern."},schema:{$ref:"http://json-schema.org/draft-07/schema#",description:"The schema definition for the given URL. The schema only needs to be provided to avoid accesses to the schema URL."}}}},"json.validate.enable":{type:"boolean",scope:"window","default":true,description:"Enable/disable JSON validation."},"json.format.enable":{type:"boolean",scope:"window","default":true,description:"Enable/disable default JSON formatter"},"json.format.keepLines":{type:"boolean",scope:"window","default":false,description:"Keep all existing new lines when formatting."},"json.trace.server":{type:"string",scope:"window","enum":["off","messages","verbose"],"default":"off",description:"Traces the communication between VS Code and the JSON language server."},"json.colorDecorators.enable":{type:"boolean",scope:"window","default":true,description:"Enables or disables color decorators",deprecationMessage:"The setting `json.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`."},"json.maxItemsComputed":{type:"number","default":5000,description:"The maximum number of outline symbols and folding regions computed (limited for performance reasons)."},"json.schemaDownload.enable":{type:"boolean","default":true,description:"When enabled, JSON schemas can be fetched from http and https locations.",tags:["usesOnlineServices"]}}},configurationDefaults:{"[json]":{"editor.quickSuggestions":{strings:true},"editor.suggest.insertMode":"replace"},"[jsonc]":{"editor.quickSuggestions":{strings:true},"editor.suggest.insertMode":"replace"}},jsonValidation:[{fileMatch:"*.schema.json",url:"http://json-schema.org/draft-07/schema#"}],commands:[{command:"json.clearCache",title:"Clear Schema Cache",category:"JSON"},{command:"json.sort",title:"Sort Document",category:"JSON"}]},dependencies:{"@vscode/extension-telemetry":"^0.8.5","request-light":"^0.7.0","vscode-languageclient":"^8.2.0-next.3"},devDependencies:{"@types/node":"18.x"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}};
|
|
4
4
|
|
|
5
5
|
const { registerFileUrl, whenReady } = registerExtension(manifest);
|
|
6
6
|
registerFileUrl('./client/dist/browser/jsonClientMain', new URL('./jsonClientMain.js', import.meta.url).toString(), 'text/javascript');
|
package/jsonClientMain.js
CHANGED
|
@@ -51,7 +51,6 @@ var SettingIds;
|
|
|
51
51
|
(function (SettingIds) {
|
|
52
52
|
SettingIds.enableFormatter = 'json.format.enable';
|
|
53
53
|
SettingIds.enableKeepLines = 'json.format.keepLines';
|
|
54
|
-
SettingIds.enableSortOnSave = 'json.sortOnSave.enable';
|
|
55
54
|
SettingIds.enableValidation = 'json.validate.enable';
|
|
56
55
|
SettingIds.enableSchemaDownload = 'json.schemaDownload.enable';
|
|
57
56
|
SettingIds.maxItemsComputed = 'json.maxItemsComputed';
|
|
@@ -87,15 +86,6 @@ async function startClient(context, newLanguageClient, runtime) {
|
|
|
87
86
|
}
|
|
88
87
|
vscode_1.window.showInformationMessage(vscode_1.l10n.t('JSON schema cache cleared.'));
|
|
89
88
|
}));
|
|
90
|
-
toDispose.push(vscode_1.workspace.onWillSaveTextDocument(event => {
|
|
91
|
-
const sortOnSave = vscode_1.workspace.getConfiguration().get(SettingIds.enableSortOnSave);
|
|
92
|
-
const document = event.document;
|
|
93
|
-
if (sortOnSave && (document.languageId === 'json' || document.languageId === 'jsonc')) {
|
|
94
|
-
const documentOptions = getOptionsForDocument(document);
|
|
95
|
-
const textEditsPromise = getSortTextEdits(document, documentOptions?.tabSize, documentOptions?.insertSpaces);
|
|
96
|
-
event.waitUntil(textEditsPromise);
|
|
97
|
-
}
|
|
98
|
-
}));
|
|
99
89
|
toDispose.push(vscode_1.commands.registerCommand('json.sort', async () => {
|
|
100
90
|
if (isClientReady) {
|
|
101
91
|
const textEditor = vscode_1.window.activeTextEditor;
|
|
@@ -118,8 +108,8 @@ async function startClient(context, newLanguageClient, runtime) {
|
|
|
118
108
|
// Register the server for json documents
|
|
119
109
|
documentSelector,
|
|
120
110
|
initializationOptions: {
|
|
121
|
-
handledSchemaProtocols: ['file'],
|
|
122
|
-
provideFormatter: false,
|
|
111
|
+
handledSchemaProtocols: ['file'], // language server only loads file-URI. Fetching schemas with other protocols ('http'...) are made on the client.
|
|
112
|
+
provideFormatter: false, // tell the server to not provide formatting capability and ignore the `json.format.enable` setting.
|
|
123
113
|
customCapabilities: { rangeFormatting: { editLimit: 10000 } }
|
|
124
114
|
},
|
|
125
115
|
synchronize: {
|
|
@@ -447,7 +437,7 @@ function getSettings() {
|
|
|
447
437
|
format: { enable: configuration.get(SettingIds.enableFormatter) },
|
|
448
438
|
keepLines: { enable: configuration.get(SettingIds.enableKeepLines) },
|
|
449
439
|
schemas,
|
|
450
|
-
resultLimit: resultLimit + 1,
|
|
440
|
+
resultLimit: resultLimit + 1, // ask for one more so we can detect if the limit has been exceeded
|
|
451
441
|
jsonFoldingLimit: jsonFoldingLimit + 1,
|
|
452
442
|
jsoncFoldingLimit: jsoncFoldingLimit + 1,
|
|
453
443
|
jsonColorDecoratorLimit: jsonColorDecoratorLimit + 1,
|
|
@@ -519,14 +509,6 @@ function updateMarkdownString(h) {
|
|
|
519
509
|
function isSchemaResolveError(d) {
|
|
520
510
|
return d.code === /* SchemaResolveError */ 0x300;
|
|
521
511
|
}
|
|
522
|
-
function getOptionsForDocument(document) {
|
|
523
|
-
for (const editor of vscode_1.window.visibleTextEditors) {
|
|
524
|
-
if (editor.document.uri.toString() === document.uri.toString()) {
|
|
525
|
-
return editor.options;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
512
|
|
|
531
513
|
|
|
532
514
|
/***/ }),
|