Skip to content

Commit

Permalink
Merge from vscode a416c77 (#8600)
Browse files Browse the repository at this point in the history
* Merge from vscode a416c77

* distro

* fix tests

* fix tests
  • Loading branch information
Anthony Dresser authored Dec 8, 2019
1 parent a7ff238 commit d614116
Show file tree
Hide file tree
Showing 155 changed files with 1,980 additions and 1,597 deletions.
4 changes: 0 additions & 4 deletions build/lib/i18n.resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@
"name": "vs/workbench/contrib/comments",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/testCustomEditors",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/debug",
"project": "vscode-workbench"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Configures an attached to container",
"allowComments": true,
"type": "object",
Expand All @@ -18,6 +18,10 @@
"type": "integer"
}
},
"settings": {
"$ref": "vscode://schemas/settings/machine",
"description": "Machine specific settings that should be copied into the container."
},
"remoteEnv": {
"type": "object",
"additionalProperties": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Defines a dev container",
"allowComments": true,
"type": "object",
Expand Down Expand Up @@ -84,6 +84,13 @@
"type": "boolean",
"description": "Controls whether on Linux the container's user should be updated with the local user's UID and GID. On by default."
},
"mounts": {
"type": "array",
"description": "Mount points to set up when creating the container. See Docker's documentation for the --mount option for the supported syntax.",
"items": {
"type": "string"
}
},
"runArgs": {
"type": "array",
"description": "The arguments required when starting in the container.",
Expand Down
1 change: 0 additions & 1 deletion extensions/image-preview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ Supported image formats:
- `*.bmp`
- `*.gif`
- `*.ico`
- `*.tga`
- `*.webp`
2 changes: 1 addition & 1 deletion extensions/image-preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "image-preview",
"displayName": "%displayName%",
"description": "%description%",
"extensionKind": "ui",
"extensionKind": ["ui", "workspace"],
"version": "1.0.0",
"publisher": "vscode",
"icon": "icon.png",
Expand Down
50 changes: 46 additions & 4 deletions extensions/json-language-features/client/src/jsonMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ import { xhr, XHRResponse, getErrorStatusDescription } from 'request-light';

const localize = nls.loadMessageBundle();

import { workspace, window, languages, commands, ExtensionContext, extensions, Uri, LanguageConfiguration, Diagnostic, StatusBarAlignment, TextEditor, TextDocument, FormattingOptions, CancellationToken, ProviderResult, TextEdit, Range, Disposable } from 'vscode';
import { LanguageClient, LanguageClientOptions, RequestType, ServerOptions, TransportKind, NotificationType, DidChangeConfigurationNotification, HandleDiagnosticsSignature, ResponseError, DocumentRangeFormattingParams, DocumentRangeFormattingRequest } from 'vscode-languageclient';
import {
workspace, window, languages, commands, ExtensionContext, extensions, Uri, LanguageConfiguration,
Diagnostic, StatusBarAlignment, TextEditor, TextDocument, FormattingOptions, CancellationToken,
ProviderResult, TextEdit, Range, Position, Disposable, CompletionItem, CompletionList, CompletionContext
} from 'vscode';
import {
LanguageClient, LanguageClientOptions, RequestType, ServerOptions, TransportKind, NotificationType,
DidChangeConfigurationNotification, HandleDiagnosticsSignature, ResponseError, DocumentRangeFormattingParams,
DocumentRangeFormattingRequest, ProvideCompletionItemsSignature
} from 'vscode-languageclient';
import TelemetryReporter from 'vscode-extension-telemetry';

import { hash } from './utils/hash';
Expand All @@ -36,6 +44,10 @@ namespace SchemaAssociationNotification {
export const type: NotificationType<ISchemaAssociations, any> = new NotificationType('json/schemaAssociations');
}

namespace ResultLimitReachedNotification {
export const type: NotificationType<string, any> = new NotificationType('json/resultLimitReached');
}

interface IPackageInfo {
name: string;
version: string;
Expand Down Expand Up @@ -132,6 +144,29 @@ export function activate(context: ExtensionContext) {
}

next(uri, diagnostics);
},
// testing the replace / insert mode
provideCompletionItem(document: TextDocument, position: Position, context: CompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature): ProviderResult<CompletionItem[] | CompletionList> {
function updateRanges(item: CompletionItem) {
const range = item.range;
if (range && range.end.isAfter(position) && range.start.isBeforeOrEqual(position)) {
item.range2 = { inserting: new Range(range.start, position), replacing: range };
item.range = undefined;
}
}
function updateProposals(r: CompletionItem[] | CompletionList | null | undefined): CompletionItem[] | CompletionList | null | undefined {
if (r) {
(Array.isArray(r) ? r : r.items).forEach(updateRanges);
}
return r;
}
const isThenable = <T>(obj: ProviderResult<T>): obj is Thenable<T> => obj && (<any>obj)['then'];

const r = next(document, position, context, token);
if (isThenable<CompletionItem[] | CompletionList | null | undefined>(r)) {
return r.then(updateProposals);
}
return updateProposals(r);
}
}
};
Expand Down Expand Up @@ -239,6 +274,12 @@ export function activate(context: ExtensionContext) {
updateFormatterRegistration();
toDispose.push({ dispose: () => rangeFormatting && rangeFormatting.dispose() });
toDispose.push(workspace.onDidChangeConfiguration(e => e.affectsConfiguration('html.format.enable') && updateFormatterRegistration()));


client.onNotification(ResultLimitReachedNotification.type, message => {
window.showInformationMessage(`${message}\nUse setting 'json.maxItemsComputed' to configure the limit.`);
});

});

let languageConfiguration: LanguageConfiguration = {
Expand Down Expand Up @@ -320,14 +361,16 @@ function getSchemaAssociation(_context: ExtensionContext): ISchemaAssociations {
function getSettings(): Settings {
let httpSettings = workspace.getConfiguration('http');

let resultLimit: number = Math.trunc(Math.max(0, Number(workspace.getConfiguration().get('json.maxItemsComputed')))) || 5000;

let settings: Settings = {
http: {
proxy: httpSettings.get('proxy'),
proxyStrictSSL: httpSettings.get('proxyStrictSSL')
},
json: {
schemas: [],
resultLimit: 5000
resultLimit
}
};
let schemaSettingsById: { [schemaId: string]: JSONSchemaSettings } = Object.create(null);
Expand Down Expand Up @@ -422,5 +465,4 @@ function readJSONFile(location: string) {
console.log(`Problems reading ${location}: ${e}`);
return {};
}

}
218 changes: 115 additions & 103 deletions extensions/json-language-features/package.json
Original file line number Diff line number Diff line change
@@ -1,113 +1,125 @@
{
"name": "json-language-features",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"publisher": "vscode",
"license": "MIT",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
"engines": {
"vscode": "0.10.x"
},
"icon": "icons/json.png",
"activationEvents": [
"onLanguage:json",
"onLanguage:jsonc"
],
"main": "./client/out/jsonMain",
"enableProposedApi": true,
"scripts": {
"compile": "gulp compile-extension:json-language-features-client compile-extension:json-language-features-server",
"watch": "gulp watch-extension:json-language-features-client watch-extension:json-language-features-server",
"postinstall": "cd server && yarn install",
"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": "%json.schemas.desc%",
"items": {
"name": "json-language-features",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"publisher": "vscode",
"license": "MIT",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
"engines": {
"vscode": "0.10.x"
},
"icon": "icons/json.png",
"activationEvents": [
"onLanguage:json",
"onLanguage:jsonc"
],
"main": "./client/out/jsonMain",
"enableProposedApi": true,
"scripts": {
"compile": "gulp compile-extension:json-language-features-client compile-extension:json-language-features-server",
"watch": "gulp watch-extension:json-language-features-client watch-extension:json-language-features-server",
"postinstall": "cd server && yarn install",
"install-client-next": "yarn add vscode-languageclient@next"
},
"categories": [
"Programming Languages"
],
"contributes": {
"configuration": {
"id": "json",
"order": 20,
"type": "object",
"default": {
"fileMatch": [
"/myfile"
],
"url": "schemaURL"
},
"title": "JSON",
"properties": {
"url": {
"type": "string",
"default": "/user.schema.json",
"description": "%json.schemas.url.desc%"
},
"fileMatch": {
"type": "array",
"items": {
"type": "string",
"default": "MyFile.json",
"description": "%json.schemas.fileMatch.item.desc%"
"json.schemas": {
"type": "array",
"scope": "resource",
"description": "%json.schemas.desc%",
"items": {
"type": "object",
"default": {
"fileMatch": [
"/myfile"
],
"url": "schemaURL"
},
"properties": {
"url": {
"type": "string",
"default": "/user.schema.json",
"description": "%json.schemas.url.desc%"
},
"fileMatch": {
"type": "array",
"items": {
"type": "string",
"default": "MyFile.json",
"description": "%json.schemas.fileMatch.item.desc%"
},
"minItems": 1,
"description": "%json.schemas.fileMatch.desc%"
},
"schema": {
"$ref": "http://json-schema.org/draft-07/schema#",
"description": "%json.schemas.schema.desc%"
}
}
}
},
"minItems": 1,
"description": "%json.schemas.fileMatch.desc%"
},
"schema": {
"$ref": "http://json-schema.org/draft-07/schema#",
"description": "%json.schemas.schema.desc%"
}
"json.format.enable": {
"type": "boolean",
"scope": "window",
"default": true,
"description": "%json.format.enable.desc%"
},
"json.trace.server": {
"type": "string",
"scope": "window",
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "%json.tracing.desc%"
},
"json.colorDecorators.enable": {
"type": "boolean",
"scope": "window",
"default": true,
"description": "%json.colorDecorators.enable.desc%",
"deprecationMessage": "%json.colorDecorators.enable.deprecationMessage%"
},
"json.maxItemsComputed": {
"type": "number",
"default": 5000,
"description": "%json.maxItemsComputed.desc%"
}
}
}
},
"json.format.enable": {
"type": "boolean",
"scope": "window",
"default": true,
"description": "%json.format.enable.desc%"
},
"json.trace.server": {
"type": "string",
"scope": "window",
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "%json.tracing.desc%"
},
"json.colorDecorators.enable": {
"type": "boolean",
"scope": "window",
"default": true,
"description": "%json.colorDecorators.enable.desc%",
"deprecationMessage": "%json.colorDecorators.enable.deprecationMessage%"
"configurationDefaults": {
"[json]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.insertMode": "replace"
},
"[jsonc]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.insertMode": "replace"
}
}
}
},
"configurationDefaults": {
"[json]": {
"editor.quickSuggestions": {
"strings": true
}
}
"dependencies": {
"request-light": "^0.2.5",
"vscode-extension-telemetry": "0.1.1",
"vscode-languageclient": "^6.0.0-next.3",
"vscode-nls": "^4.1.1"
},
"devDependencies": {
"@types/node": "^12.11.7"
}
},
"dependencies": {
"request-light": "^0.2.5",
"vscode-extension-telemetry": "0.1.1",
"vscode-languageclient": "^6.0.0-next.3",
"vscode-nls": "^4.1.1"
},
"devDependencies": {
"@types/node": "^12.11.7"
}
}
3 changes: 2 additions & 1 deletion extensions/json-language-features/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"json.colorDecorators.enable.desc": "Enables or disables color decorators",
"json.colorDecorators.enable.deprecationMessage": "The setting `json.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.",
"json.schemaResolutionErrorMessage": "Unable to resolve schema.",
"json.clickToRetry": "Click to retry."
"json.clickToRetry": "Click to retry.",
"json.maxItemsComputed.desc": "The maximum number of outline symbols and folding regions computed (limited for performance reasons)."
}
Loading

0 comments on commit d614116

Please sign in to comment.