Merge master

This commit is contained in:
roblou
2016-11-30 10:26:24 -08:00
390 changed files with 10608 additions and 67698 deletions
+11
View File
@@ -19,6 +19,17 @@
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/**/*.js" ]
},
{
"type": "node",
"request": "launch",
"name": "Gulp Build",
"program": "${workspaceRoot}/node_modules/gulp/bin/gulp.js",
"stopOnEntry": true,
"args": [
"watch-extension:json-client"
],
"cwd": "${workspaceRoot}"
},
{
"type": "node",
"request": "attach",
+7 -7
View File
@@ -28,10 +28,10 @@ const compilations = glob.sync('**/tsconfig.json', {
ignore: ['**/out/**', '**/node_modules/**']
});
const getBaseUrl = out => `https://ticino.blob.core.windows.net/sourcemaps/${ commit }/${ out }`;
const getBaseUrl = out => `https://ticino.blob.core.windows.net/sourcemaps/${commit}/${out}`;
const languages = ['chs', 'cht', 'jpn', 'kor', 'deu', 'fra', 'esn', 'rus', 'ita'];
const tasks = compilations.map(function(tsconfigFile) {
const tasks = compilations.map(function (tsconfigFile) {
const absolutePath = path.join(extensionsPath, tsconfigFile);
const relativeDirname = path.dirname(tsconfigFile);
@@ -58,7 +58,7 @@ const tasks = compilations.map(function(tsconfigFile) {
const i18n = path.join(__dirname, '..', 'i18n');
const baseUrl = getBaseUrl(out);
function createPipeline(build) {
function createPipeline(build, emitError) {
const reporter = createReporter();
tsOptions.inlineSources = !!build;
@@ -74,14 +74,14 @@ const tasks = compilations.map(function(tsconfigFile) {
.pipe(build ? nlsDev.rewriteLocalizeCalls() : es.through())
.pipe(build ? util.stripSourceMappingURL() : es.through())
.pipe(sourcemaps.write('.', {
sourceMappingURL: !build ? null : f => `${ baseUrl }/${ f.relative }.map`,
sourceMappingURL: !build ? null : f => `${baseUrl}/${f.relative}.map`,
addComment: !!build,
includeContent: !!build,
sourceRoot: '../src'
}))
.pipe(tsFilter.restore)
.pipe(build ? nlsDev.createAdditionalLanguageFiles(languages, i18n, out) : es.through())
.pipe(reporter.end());
.pipe(reporter.end(emitError));
return es.duplex(input, output);
};
@@ -92,7 +92,7 @@ const tasks = compilations.map(function(tsconfigFile) {
gulp.task(clean, cb => rimraf(out, cb));
gulp.task(compile, [clean], () => {
const pipeline = createPipeline(false);
const pipeline = createPipeline(false, true);
const input = gulp.src(src, srcOpts);
return input
@@ -113,7 +113,7 @@ const tasks = compilations.map(function(tsconfigFile) {
gulp.task(cleanBuild, cb => rimraf(out, cb));
gulp.task(compileBuild, [clean], () => {
const pipeline = createPipeline(true);
const pipeline = createPipeline(true, true);
const input = gulp.src(src, srcOpts);
return input
+2 -2
View File
@@ -39,8 +39,8 @@ const nodeModules = ['electron', 'original-fs']
// Build
const builtInExtensions = [
{ name: 'ms-vscode.node-debug', version: '1.8.3' },
{ name: 'ms-vscode.node-debug2', version: '1.8.1' }
{ name: 'ms-vscode.node-debug', version: '1.8.7' },
{ name: 'ms-vscode.node-debug2', version: '1.8.2' }
];
const vscodeEntryPoints = _.flatten([
+5 -1
View File
@@ -20,6 +20,9 @@ function onEnd() {
if (--count > 0) {
return;
}
log();
}
function log() {
var errors = _.flatten(allErrors);
errors.map(function (err) { return util.log(util.colors.red('Error') + ": " + err); });
util.log("Finished " + util.colors.green('compilation') + " with " + errors.length + " errors after " + util.colors.magenta((new Date().getTime() - startTime) + ' ms'));
@@ -40,7 +43,8 @@ function createReporter() {
return es.through(null, function () {
onEnd();
if (emitError && errors.length > 0) {
this.emit('error', 'Errors occurred.');
log();
this.emit('error');
}
else {
this.emit('end');
+18 -13
View File
@@ -9,8 +9,8 @@ import * as es from 'event-stream';
import * as _ from 'underscore';
import * as util from 'gulp-util';
const allErrors:Error[][] = [];
let startTime:number = null;
const allErrors: Error[][] = [];
let startTime: number = null;
let count = 0;
function onStart(): void {
@@ -19,32 +19,36 @@ function onStart(): void {
}
startTime = new Date().getTime();
util.log(`Starting ${ util.colors.green('compilation') }...`);
util.log(`Starting ${util.colors.green('compilation')}...`);
}
function onEnd(): void {
if (--count > 0) {
return ;
return;
}
const errors = _.flatten(allErrors);
errors.map(err => util.log(`${ util.colors.red('Error') }: ${ err }`));
log();
}
util.log(`Finished ${ util.colors.green('compilation') } with ${ errors.length } errors after ${ util.colors.magenta((new Date().getTime() - startTime) + ' ms') }`);
function log(): void {
const errors = _.flatten(allErrors);
errors.map(err => util.log(`${util.colors.red('Error')}: ${err}`));
util.log(`Finished ${util.colors.green('compilation')} with ${errors.length} errors after ${util.colors.magenta((new Date().getTime() - startTime) + ' ms')}`);
}
export interface IReporter {
(err:Error): void;
(err: Error): void;
hasErrors(): boolean;
end(emitError:boolean): NodeJS.ReadWriteStream;
end(emitError: boolean): NodeJS.ReadWriteStream;
}
export function createReporter(): IReporter {
const errors:Error[] = [];
const errors: Error[] = [];
allErrors.push(errors);
class ReportFunc {
constructor(err:Error) {
constructor(err: Error) {
errors.push(err);
}
@@ -52,7 +56,7 @@ export function createReporter(): IReporter {
return errors.length > 0;
}
static end(emitError:boolean): NodeJS.ReadWriteStream {
static end(emitError: boolean): NodeJS.ReadWriteStream {
errors.length = 0;
onStart();
@@ -60,7 +64,8 @@ export function createReporter(): IReporter {
onEnd();
if (emitError && errors.length > 0) {
this.emit('error', 'Errors occurred.');
log();
this.emit('error');
} else {
this.emit('end');
}
+14 -10
View File
@@ -6,6 +6,19 @@
const cp = require('child_process');
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
function npmInstall(location) {
const result = cp.spawnSync(npm, ['install'], {
cwd: location ,
stdio: 'inherit'
});
if (result.error || result.status !== 0) {
process.exit(1);
}
}
npmInstall('extensions'); // node modules shared by all extensions
const extensions = [
'vscode-api-tests',
'vscode-colorize-tests',
@@ -20,13 +33,4 @@ const extensions = [
'html'
];
extensions.forEach(extension => {
const result = cp.spawnSync(npm, ['install'], {
cwd: `extensions/${extension}`,
stdio: 'inherit'
});
if (result.error || result.status !== 0) {
process.exit(1);
}
});
extensions.forEach(extension => npmInstall(`extensions/${extension}`));
@@ -44,16 +44,29 @@ function registerKeybindingsCompletions(): vscode.Disposable {
});
}
function updateLaunchJsonDecorations(editor: vscode.TextEditor) {
function newCompletionItem(text: string, range: vscode.Range) {
const item = new vscode.CompletionItem(JSON.stringify(text));
item.kind = vscode.CompletionItemKind.Value;
item.textEdit = {
range,
newText: item.label
};
return item;
}
function updateLaunchJsonDecorations(editor: vscode.TextEditor | undefined) {
if (!editor || path.basename(editor.document.fileName) !== 'launch.json') {
return;
}
const ranges = [];
const ranges: vscode.Range[] = [];
let addPropertyAndValue = false;
let depthInArray = 0;
visit(editor.document.getText(), {
onObjectProperty: (property, offset, length) => {
addPropertyAndValue = property === 'version' || property === 'type' || property === 'request' || property === 'configurations';
// Decorate attributes which are unlikely to be edited by the user.
// Only decorate "configurations" if it is not inside an array (compounds have a configurations property which should not be decorated).
addPropertyAndValue = property === 'version' || property === 'type' || property === 'request' || property === 'compounds' || (property === 'configurations' && depthInArray === 0);
if (addPropertyAndValue) {
ranges.push(new vscode.Range(editor.document.positionAt(offset), editor.document.positionAt(offset + length)));
}
@@ -62,19 +75,15 @@ function updateLaunchJsonDecorations(editor: vscode.TextEditor) {
if (addPropertyAndValue) {
ranges.push(new vscode.Range(editor.document.positionAt(offset), editor.document.positionAt(offset + length)));
}
},
onArrayBegin: (offset: number, length: number) => {
depthInArray++;
},
onArrayEnd: (offset: number, length: number) => {
depthInArray--;
}
});
editor.setDecorations(decoration, ranges);
}
function newCompletionItem(text: string, range: vscode.Range, documentation?: string) {
const item = new vscode.CompletionItem(JSON.stringify(text));
item.kind = vscode.CompletionItemKind.Value;
item.documentation = documentation;
item.textEdit = {
range,
newText: item.label
};
return item;
}
@@ -3,9 +3,10 @@
"noLib": true,
"target": "es5",
"module": "commonjs",
"outDir": "./out"
"outDir": "./out",
"strictNullChecks": true
},
"exclude": [
"node_modules"
]
}
}
+18 -18
View File
@@ -7,14 +7,14 @@
import * as path from 'path';
import { languages, window, commands, ExtensionContext } from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, RequestType, Range, TextEdit, Protocol2Code } from 'vscode-languageclient';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, RequestType, Range, TextEdit } from 'vscode-languageclient';
import { activateColorDecorations } from './colorDecorators';
import * as nls from 'vscode-nls';
let localize = nls.loadMessageBundle();
namespace ColorSymbolRequest {
export const type: RequestType<string, Range[], any> = { get method() { return 'css/colorSymbols'; } };
export const type: RequestType<string, Range[], any, any> = { get method() { return 'css/colorSymbols'; }, _: null };
}
// this method is called when vs code is activated
@@ -51,7 +51,7 @@ export function activate(context: ExtensionContext) {
context.subscriptions.push(disposable);
let colorRequestor = (uri: string) => {
return client.sendRequest(ColorSymbolRequest.type, uri).then(ranges => ranges.map(Protocol2Code.asRange));
return client.sendRequest(ColorSymbolRequest.type, uri).then(ranges => ranges.map(client.protocol2CodeConverter.asRange));
};
disposable = activateColorDecorations(colorRequestor, { css: true, scss: true, less: true });
context.subscriptions.push(disposable);
@@ -69,23 +69,23 @@ export function activate(context: ExtensionContext) {
});
commands.registerCommand('_css.applyCodeAction', applyCodeAction);
}
function applyCodeAction(uri: string, documentVersion: number, edits: TextEdit[]) {
let textEditor = window.activeTextEditor;
if (textEditor && textEditor.document.uri.toString() === uri) {
if (textEditor.document.version !== documentVersion) {
window.showInformationMessage(`CSS fix is outdated and can't be applied to the document.`);
function applyCodeAction(uri: string, documentVersion: number, edits: TextEdit[]) {
let textEditor = window.activeTextEditor;
if (textEditor && textEditor.document.uri.toString() === uri) {
if (textEditor.document.version !== documentVersion) {
window.showInformationMessage(`CSS fix is outdated and can't be applied to the document.`);
}
textEditor.edit(mutator => {
for (let edit of edits) {
mutator.replace(client.protocol2CodeConverter.asRange(edit.range), edit.newText);
}
}).then(success => {
if (!success) {
window.showErrorMessage('Failed to apply CSS fix to the document. Please consider opening an issue with steps to reproduce.');
}
});
}
textEditor.edit(mutator => {
for (let edit of edits) {
mutator.replace(Protocol2Code.asRange(edit.range), edit.newText);
}
}).then(success => {
if (!success) {
window.showErrorMessage('Failed to apply CSS fix to the document. Please consider opening an issue with steps to reproduce.');
}
});
}
}
+1 -6
View File
@@ -3,9 +3,4 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../../src/typings/mocha.d.ts'/>
/// <reference path='../../../../../extensions/node.d.ts'/>
/// <reference path='../../../../../extensions/lib.core.d.ts'/>
/// <reference path='../../../../../extensions/declares.d.ts'/>
/// <reference path='../../../node_modules/vscode-languageclient/lib/main.d.ts'/>
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
+4 -2
View File
@@ -1,9 +1,11 @@
{
"compilerOptions": {
"noLib": true,
"target": "es5",
"module": "commonjs",
"outDir": "./out"
"outDir": "./out",
"lib": [
"es5", "es2015.promise"
]
},
"exclude": [
"node_modules"
+8 -8
View File
@@ -3,19 +3,19 @@
"version": "0.1.0",
"dependencies": {
"vscode-jsonrpc": {
"version": "2.3.2-next.5",
"from": "vscode-jsonrpc@>=2.3.2-next.2 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-2.3.2-next.5.tgz"
"version": "3.0.1-alpha.2",
"from": "vscode-jsonrpc@>=3.0.1-alpha.2 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.0.1-alpha.2.tgz"
},
"vscode-languageclient": {
"version": "2.4.2-next.22",
"version": "3.0.1-alpha.2",
"from": "vscode-languageclient@next",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-2.4.2-next.22.tgz"
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-3.0.1-alpha.2.tgz"
},
"vscode-languageserver-types": {
"version": "1.0.3",
"from": "vscode-languageserver-types@>=1.0.3 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.3.tgz"
"version": "3.0.1-alpha.2",
"from": "vscode-languageserver-types@>=3.0.1-alpha.2 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.1-alpha.2.tgz"
},
"vscode-nls": {
"version": "1.0.7",
+61 -58
View File
@@ -61,7 +61,7 @@
"css.validate": {
"type": "boolean",
"default": true,
"description": "Enables or disables all validations"
"description": "%css.validate.desc%"
},
"css.lint.compatibleVendorPrefixes": {
"type": "string",
@@ -71,7 +71,7 @@
"error"
],
"default": "ignore",
"description": "When using a vendor-specific prefix make sure to also include all other vendor-specific properties"
"description": "%css.lint.compatibleVendorPrefixes.desc%"
},
"css.lint.vendorPrefix": {
"type": "string",
@@ -81,7 +81,7 @@
"error"
],
"default": "warning",
"description": "When using a vendor-specific prefix also include the standard property"
"description": "%css.lint.vendorPrefix.desc%"
},
"css.lint.duplicateProperties": {
"type": "string",
@@ -91,7 +91,7 @@
"error"
],
"default": "ignore",
"description": "Do not use duplicate style definitions"
"description": "%css.lint.duplicateProperties.desc%"
},
"css.lint.emptyRules": {
"type": "string",
@@ -101,7 +101,7 @@
"error"
],
"default": "warning",
"description": "Do not use empty rulesets"
"description": "%css.lint.emptyRules.desc%"
},
"css.lint.importStatement": {
"type": "string",
@@ -111,7 +111,7 @@
"error"
],
"default": "ignore",
"description": "Import statements do not load in parallel"
"description": "%css.lint.importStatement.desc%"
},
"css.lint.boxModel": {
"type": "string",
@@ -121,7 +121,7 @@
"error"
],
"default": "ignore",
"description": "Do not use width or height when using padding or border"
"description": "%css.lint.boxModel.desc%"
},
"css.lint.universalSelector": {
"type": "string",
@@ -131,7 +131,7 @@
"error"
],
"default": "ignore",
"description": "The universal selector (*) is known to be slow"
"description": "%css.lint.universalSelector.desc%"
},
"css.lint.zeroUnits": {
"type": "string",
@@ -141,7 +141,7 @@
"error"
],
"default": "ignore",
"description": "No unit for zero needed"
"description": "%css.lint.zeroUnits.desc%"
},
"css.lint.fontFaceProperties": {
"type": "string",
@@ -151,7 +151,7 @@
"error"
],
"default": "warning",
"description": "@font-face rule must define 'src' and 'font-family' properties"
"description": "%css.lint.fontFaceProperties.desc%"
},
"css.lint.hexColorLength": {
"type": "string",
@@ -161,7 +161,7 @@
"error"
],
"default": "error",
"description": "Hex colors must consist of three or six hex numbers"
"description": "%css.lint.hexColorLength.desc%"
},
"css.lint.argumentsInColorFunction": {
"type": "string",
@@ -171,7 +171,7 @@
"error"
],
"default": "error",
"description": "Invalid number of parameters"
"description": "%css.lint.argumentsInColorFunction.desc%"
},
"css.lint.unknownProperties": {
"type": "string",
@@ -181,7 +181,7 @@
"error"
],
"default": "warning",
"description": "Unknown property."
"description": "%css.lint.unknownProperties.desc%"
},
"css.lint.ieHack": {
"type": "string",
@@ -191,7 +191,7 @@
"error"
],
"default": "ignore",
"description": "IE hacks are only necessary when supporting IE7 and older"
"description": "%css.lint.ieHack.desc%"
},
"css.lint.unknownVendorSpecificProperties": {
"type": "string",
@@ -201,7 +201,7 @@
"error"
],
"default": "ignore",
"description": "Unknown vendor specific property."
"description": "%css.lint.unknownVendorSpecificProperties.desc%"
},
"css.lint.propertyIgnoredDueToDisplay": {
"type": "string",
@@ -211,7 +211,7 @@
"error"
],
"default": "warning",
"description": "Property is ignored due to the display. E.g. with 'display: inline', the width, height, margin-top, margin-bottom, and float properties have no effect"
"description": "%css.lint.propertyIgnoredDueToDisplay.desc%"
},
"css.lint.important": {
"type": "string",
@@ -221,7 +221,7 @@
"error"
],
"default": "ignore",
"description": "Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored."
"description": "%css.lint.important.desc%"
},
"css.lint.float": {
"type": "string",
@@ -231,7 +231,7 @@
"error"
],
"default": "ignore",
"description": "Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes."
"description": "%css.lint.float.desc%"
},
"css.lint.idSelector": {
"type": "string",
@@ -241,7 +241,7 @@
"error"
],
"default": "ignore",
"description": "Selectors should not contain IDs because these rules are too tightly coupled with the HTML."
"description": "%css.lint.idSelector.desc%"
}
}
}
@@ -258,7 +258,7 @@
"scss.validate": {
"type": "boolean",
"default": true,
"description": "Enables or disables all validations"
"description": "%scss.validate.desc%"
},
"scss.lint.compatibleVendorPrefixes": {
"type": "string",
@@ -268,7 +268,7 @@
"error"
],
"default": "ignore",
"description": "When using a vendor-specific prefix make sure to also include all other vendor-specific properties"
"description": "%scss.lint.compatibleVendorPrefixes.desc%"
},
"scss.lint.vendorPrefix": {
"type": "string",
@@ -278,7 +278,7 @@
"error"
],
"default": "warning",
"description": "When using a vendor-specific prefix also include the standard property"
"description": "%scss.lint.vendorPrefix.desc%"
},
"scss.lint.duplicateProperties": {
"type": "string",
@@ -288,7 +288,7 @@
"error"
],
"default": "ignore",
"description": "Do not use duplicate style definitions"
"description": "%scss.lint.duplicateProperties.desc%"
},
"scss.lint.emptyRules": {
"type": "string",
@@ -298,7 +298,7 @@
"error"
],
"default": "warning",
"description": "Do not use empty rulesets"
"description": "%scss.lint.emptyRules.desc%"
},
"scss.lint.importStatement": {
"type": "string",
@@ -308,7 +308,7 @@
"error"
],
"default": "ignore",
"description": "Import statements do not load in parallel"
"description": "%scss.lint.importStatement.desc%"
},
"scss.lint.boxModel": {
"type": "string",
@@ -318,7 +318,7 @@
"error"
],
"default": "ignore",
"description": "Do not use width or height when using padding or border"
"description": "%scss.lint.boxModel.desc%"
},
"scss.lint.universalSelector": {
"type": "string",
@@ -328,7 +328,7 @@
"error"
],
"default": "ignore",
"description": "The universal selector (*) is known to be slow"
"description": "%scss.lint.universalSelector.desc%"
},
"scss.lint.zeroUnits": {
"type": "string",
@@ -338,7 +338,7 @@
"error"
],
"default": "ignore",
"description": "No unit for zero needed"
"description": "%scss.lint.zeroUnits.desc%"
},
"scss.lint.fontFaceProperties": {
"type": "string",
@@ -348,7 +348,7 @@
"error"
],
"default": "warning",
"description": "@font-face rule must define 'src' and 'font-family' properties"
"description": "%scss.lint.fontFaceProperties.desc%"
},
"scss.lint.hexColorLength": {
"type": "string",
@@ -358,7 +358,7 @@
"error"
],
"default": "error",
"description": "Hex colors must consist of three or six hex numbers"
"description": "%scss.lint.hexColorLength.desc%"
},
"scss.lint.argumentsInColorFunction": {
"type": "string",
@@ -368,7 +368,7 @@
"error"
],
"default": "error",
"description": "Invalid number of parameters"
"description": "%scss.lint.argumentsInColorFunction.desc%"
},
"scss.lint.unknownProperties": {
"type": "string",
@@ -378,7 +378,7 @@
"error"
],
"default": "warning",
"description": "Unknown property."
"description": "%scss.lint.unknownProperties.desc%"
},
"scss.lint.ieHack": {
"type": "string",
@@ -388,7 +388,7 @@
"error"
],
"default": "ignore",
"description": "IE hacks are only necessary when supporting IE7 and older"
"description": "%scss.lint.ieHack.desc%"
},
"scss.lint.unknownVendorSpecificProperties": {
"type": "string",
@@ -398,7 +398,7 @@
"error"
],
"default": "ignore",
"description": "Unknown vendor specific property."
"description": "%scss.lint.unknownVendorSpecificProperties.desc%"
},
"scss.lint.propertyIgnoredDueToDisplay": {
"type": "string",
@@ -408,7 +408,7 @@
"error"
],
"default": "warning",
"description": "Property is ignored due to the display. E.g. with 'display: inline', the width, height, margin-top, margin-bottom, and float properties have no effect"
"description": "%scss.lint.propertyIgnoredDueToDisplay.desc%"
},
"scss.lint.important": {
"type": "string",
@@ -418,7 +418,7 @@
"error"
],
"default": "ignore",
"description": "Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored."
"description": "%scss.lint.important.desc%"
},
"scss.lint.float": {
"type": "string",
@@ -428,7 +428,7 @@
"error"
],
"default": "ignore",
"description": "Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes."
"description": "%scss.lint.float.desc%"
},
"scss.lint.idSelector": {
"type": "string",
@@ -438,7 +438,7 @@
"error"
],
"default": "ignore",
"description": "Selectors should not contain IDs because these rules are too tightly coupled with the HTML."
"description": "%scss.lint.idSelector.desc%"
}
}
}
@@ -456,7 +456,7 @@
"less.validate": {
"type": "boolean",
"default": true,
"description": "Enables or disables all validations"
"description": "%less.validate.desc%"
},
"less.lint.compatibleVendorPrefixes": {
"type": "string",
@@ -466,7 +466,7 @@
"error"
],
"default": "ignore",
"description": "When using a vendor-specific prefix make sure to also include all other vendor-specific properties"
"description": "%less.lint.compatibleVendorPrefixes.desc%"
},
"less.lint.vendorPrefix": {
"type": "string",
@@ -476,7 +476,7 @@
"error"
],
"default": "warning",
"description": "When using a vendor-specific prefix also include the standard property"
"description": "%less.lint.vendorPrefix.desc%"
},
"less.lint.duplicateProperties": {
"type": "string",
@@ -486,7 +486,7 @@
"error"
],
"default": "ignore",
"description": "Do not use duplicate style definitions"
"description": "%less.lint.duplicateProperties.desc%"
},
"less.lint.emptyRules": {
"type": "string",
@@ -496,7 +496,7 @@
"error"
],
"default": "warning",
"description": "Do not use empty rulesets"
"description": "%less.lint.emptyRules.desc%"
},
"less.lint.importStatement": {
"type": "string",
@@ -506,7 +506,7 @@
"error"
],
"default": "ignore",
"description": "Import statements do not load in parallel"
"description": "%less.lint.importStatement.desc%"
},
"less.lint.boxModel": {
"type": "string",
@@ -516,7 +516,7 @@
"error"
],
"default": "ignore",
"description": "Do not use width or height when using padding or border"
"description": "%less.lint.boxModel.desc%"
},
"less.lint.universalSelector": {
"type": "string",
@@ -526,7 +526,7 @@
"error"
],
"default": "ignore",
"description": "The universal selector (*) is known to be slow"
"description": "%less.lint.universalSelector.desc%"
},
"less.lint.zeroUnits": {
"type": "string",
@@ -536,7 +536,7 @@
"error"
],
"default": "ignore",
"description": "No unit for zero needed"
"description": "%less.lint.zeroUnits.desc%"
},
"less.lint.fontFaceProperties": {
"type": "string",
@@ -546,7 +546,7 @@
"error"
],
"default": "warning",
"description": "@font-face rule must define 'src' and 'font-family' properties"
"description": "%less.lint.fontFaceProperties.desc%"
},
"less.lint.hexColorLength": {
"type": "string",
@@ -556,7 +556,7 @@
"error"
],
"default": "error",
"description": "Hex colors must consist of three or six hex numbers"
"description": "%less.lint.hexColorLength.desc%"
},
"less.lint.argumentsInColorFunction": {
"type": "string",
@@ -566,7 +566,7 @@
"error"
],
"default": "error",
"description": "Invalid number of parameters"
"description": "%less.lint.argumentsInColorFunction.desc%"
},
"less.lint.unknownProperties": {
"type": "string",
@@ -576,7 +576,7 @@
"error"
],
"default": "warning",
"description": "Unknown property."
"description": "%less.lint.unknownProperties.desc%"
},
"less.lint.ieHack": {
"type": "string",
@@ -586,7 +586,7 @@
"error"
],
"default": "ignore",
"description": "IE hacks are only necessary when supporting IE7 and older"
"description": "%less.lint.ieHack.desc%"
},
"less.lint.unknownVendorSpecificProperties": {
"type": "string",
@@ -596,7 +596,7 @@
"error"
],
"default": "ignore",
"description": "Unknown vendor specific property."
"description": "%less.lint.unknownVendorSpecificProperties.desc%"
},
"less.lint.propertyIgnoredDueToDisplay": {
"type": "string",
@@ -606,7 +606,7 @@
"error"
],
"default": "warning",
"description": "Property is ignored due to the display. E.g. with 'display: inline', the width, height, margin-top, margin-bottom, and float properties have no effect"
"description": "%less.lint.propertyIgnoredDueToDisplay.desc%"
},
"less.lint.important": {
"type": "string",
@@ -616,7 +616,7 @@
"error"
],
"default": "ignore",
"description": "Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored."
"description": "%less.lint.important.desc%"
},
"less.lint.float": {
"type": "string",
@@ -626,7 +626,7 @@
"error"
],
"default": "ignore",
"description": "Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes."
"description": "%less.lint.float.desc%"
},
"less.lint.idSelector": {
"type": "string",
@@ -636,7 +636,7 @@
"error"
],
"default": "ignore",
"description": "Selectors should not contain IDs because these rules are too tightly coupled with the HTML."
"description": "%less.lint.idSelector.desc%"
}
}
}
@@ -646,7 +646,10 @@
}
},
"dependencies": {
"vscode-languageclient": "^2.4.2-next.22",
"vscode-languageclient": "3.0.1-alpha.2",
"vscode-nls": "^1.0.7"
},
"devDependencies": {
"@types/node": "^6.0.51"
}
}
+59
View File
@@ -0,0 +1,59 @@
{
"css.lint.argumentsInColorFunction.desc": "Invalid number of parameters",
"css.lint.boxModel.desc": "Do not use width or height when using padding or border",
"css.lint.compatibleVendorPrefixes.desc": "When using a vendor-specific prefix make sure to also include all other vendor-specific properties",
"css.lint.duplicateProperties.desc": "Do not use duplicate style definitions",
"css.lint.emptyRules.desc": "Do not use empty rulesets",
"css.lint.float.desc": "Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.",
"css.lint.fontFaceProperties.desc": "@font-face rule must define 'src' and 'font-family' properties",
"css.lint.hexColorLength.desc": "Hex colors must consist of three or six hex numbers",
"css.lint.idSelector.desc": "Selectors should not contain IDs because these rules are too tightly coupled with the HTML.",
"css.lint.ieHack.desc": "IE hacks are only necessary when supporting IE7 and older",
"css.lint.important.desc": "Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.",
"css.lint.importStatement.desc": "Import statements do not load in parallel",
"css.lint.propertyIgnoredDueToDisplay.desc": "Property is ignored due to the display. E.g. with 'display: inline', the width, height, margin-top, margin-bottom, and float properties have no effect",
"css.lint.universalSelector.desc": "The universal selector (*) is known to be slow",
"css.lint.unknownProperties.desc": "Unknown property.",
"css.lint.unknownVendorSpecificProperties.desc": "Unknown vendor specific property.",
"css.lint.vendorPrefix.desc": "When using a vendor-specific prefix also include the standard property",
"css.lint.zeroUnits.desc": "No unit for zero needed",
"css.validate.desc": "Enables or disables all validations",
"less.lint.argumentsInColorFunction.desc": "Invalid number of parameters",
"less.lint.boxModel.desc": "Do not use width or height when using padding or border",
"less.lint.compatibleVendorPrefixes.desc": "When using a vendor-specific prefix make sure to also include all other vendor-specific properties",
"less.lint.duplicateProperties.desc": "Do not use duplicate style definitions",
"less.lint.emptyRules.desc": "Do not use empty rulesets",
"less.lint.float.desc": "Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.",
"less.lint.fontFaceProperties.desc": "@font-face rule must define 'src' and 'font-family' properties",
"less.lint.hexColorLength.desc": "Hex colors must consist of three or six hex numbers",
"less.lint.idSelector.desc": "Selectors should not contain IDs because these rules are too tightly coupled with the HTML.",
"less.lint.ieHack.desc": "IE hacks are only necessary when supporting IE7 and older",
"less.lint.important.desc": "Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.",
"less.lint.importStatement.desc": "Import statements do not load in parallel",
"less.lint.propertyIgnoredDueToDisplay.desc": "Property is ignored due to the display. E.g. with 'display: inline', the width, height, margin-top, margin-bottom, and float properties have no effect",
"less.lint.universalSelector.desc": "The universal selector (*) is known to be slow",
"less.lint.unknownProperties.desc": "Unknown property.",
"less.lint.unknownVendorSpecificProperties.desc": "Unknown vendor specific property.",
"less.lint.vendorPrefix.desc": "When using a vendor-specific prefix also include the standard property",
"less.lint.zeroUnits.desc": "No unit for zero needed",
"less.validate.desc": "Enables or disables all validations",
"scss.lint.argumentsInColorFunction.desc": "Invalid number of parameters",
"scss.lint.boxModel.desc": "Do not use width or height when using padding or border",
"scss.lint.compatibleVendorPrefixes.desc": "When using a vendor-specific prefix make sure to also include all other vendor-specific properties",
"scss.lint.duplicateProperties.desc": "Do not use duplicate style definitions",
"scss.lint.emptyRules.desc": "Do not use empty rulesets",
"scss.lint.float.desc": "Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.",
"scss.lint.fontFaceProperties.desc": "@font-face rule must define 'src' and 'font-family' properties",
"scss.lint.hexColorLength.desc": "Hex colors must consist of three or six hex numbers",
"scss.lint.idSelector.desc": "Selectors should not contain IDs because these rules are too tightly coupled with the HTML.",
"scss.lint.ieHack.desc": "IE hacks are only necessary when supporting IE7 and older",
"scss.lint.important.desc": "Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.",
"scss.lint.importStatement.desc": "Import statements do not load in parallel",
"scss.lint.propertyIgnoredDueToDisplay.desc": "Property is ignored due to the display. E.g. with 'display: inline', the width, height, margin-top, margin-bottom, and float properties have no effect",
"scss.lint.universalSelector.desc": "The universal selector (*) is known to be slow",
"scss.lint.unknownProperties.desc": "Unknown property.",
"scss.lint.unknownVendorSpecificProperties.desc": "Unknown vendor specific property.",
"scss.lint.vendorPrefix.desc": "When using a vendor-specific prefix also include the standard property",
"scss.lint.zeroUnits.desc": "No unit for zero needed",
"scss.validate.desc": "Enables or disables all validations"
}
+10 -22
View File
@@ -3,41 +3,29 @@
"version": "1.0.0",
"dependencies": {
"vscode-css-languageservice": {
"version": "1.1.0",
"version": "2.0.0-next.5",
"from": "vscode-css-languageservice@next",
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-1.1.0.tgz"
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-2.0.0-next.5.tgz"
},
"vscode-jsonrpc": {
"version": "2.3.2-next.5",
"from": "vscode-jsonrpc@>=2.3.2-next.2 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-2.3.2-next.5.tgz"
"version": "3.0.1-alpha.2",
"from": "vscode-jsonrpc@>=3.0.1-alpha.2 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.0.1-alpha.2.tgz"
},
"vscode-languageserver": {
"version": "2.4.0-next.12",
"version": "3.0.1-alpha.2",
"from": "vscode-languageserver@next",
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-2.4.0-next.12.tgz",
"dependencies": {
"vscode-languageserver-types": {
"version": "1.0.3",
"from": "vscode-languageserver-types@>=1.0.3 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.3.tgz"
}
}
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.0.1-alpha.2.tgz"
},
"vscode-languageserver-types": {
"version": "1.0.3",
"from": "vscode-languageserver-types@>=1.0.3 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.3.tgz"
"version": "3.0.1-alpha.2",
"from": "vscode-languageserver-types@>=3.0.1-alpha.2 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.1-alpha.2.tgz"
},
"vscode-nls": {
"version": "1.0.7",
"from": "vscode-nls@>=1.0.4 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-1.0.7.tgz"
},
"vscode-uri": {
"version": "1.0.0",
"from": "vscode-uri@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.0.tgz"
}
}
}
+5 -2
View File
@@ -8,8 +8,11 @@
"node": "*"
},
"dependencies": {
"vscode-css-languageservice": "^1.1.0",
"vscode-languageserver": "^2.4.0-next.12"
"vscode-css-languageservice": "^2.0.0-next.5",
"vscode-languageserver": "3.0.1-alpha.2"
},
"devDependencies": {
"@types/node": "^6.0.51"
},
"scripts": {
"compile": "gulp compile-extension:css-server",
+1 -1
View File
@@ -13,7 +13,7 @@ import { getCSSLanguageService, getSCSSLanguageService, getLESSLanguageService,
import { getLanguageModelCache } from './languageModelCache';
namespace ColorSymbolRequest {
export const type: RequestType<string, Range[], any> = { get method() { return 'css/colorSymbols'; } };
export const type: RequestType<string, Range[], any, any> = { get method() { return 'css/colorSymbols'; }, _: null };
}
export interface Settings {
-112
View File
@@ -1,112 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/**
* The Thenable (E.g. PromiseLike) and Promise declarions are taken from TypeScript's
* lib.core.es6.d.ts file. See above Copyright notice.
*/
/**
* Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
* and others. This API makes no assumption about what promise libary is being used which
* enables reusing existing code without migrating to a specific promise implementation. Still,
* we recommand the use of native promises which are available in VS Code.
*/
interface Thenable<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
}
/**
* Represents the completion of an asynchronous operation
*/
interface Promise<T> extends Thenable<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Promise<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
/**
* Attaches a callback for only the rejection of the Promise.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of the callback.
*/
catch(onrejected?: (reason: any) => T | Thenable<T>): Promise<T>;
}
interface PromiseConstructor {
/**
* Creates a new Promise.
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
new <T>(executor: (resolve: (value?: T | Thenable<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T>(values: Array<T | Thenable<T>>): Promise<T[]>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T>(values: Array<T | Thenable<T>>): Promise<T>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject(reason: any): Promise<void>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject<T>(reason: any): Promise<T>;
/**
* Creates a new resolved promise for the provided value.
* @param value A promise.
* @returns A promise whose internal state matches the provided promise.
*/
resolve<T>(value: T | Thenable<T>): Promise<T>;
/**
* Creates a new resolved promise .
* @returns A resolved promise.
*/
resolve(): Promise<void>;
}
declare var Promise: PromiseConstructor;
+4 -2
View File
@@ -1,9 +1,11 @@
{
"compilerOptions": {
"noLib": true,
"target": "es5",
"module": "commonjs",
"outDir": "./out"
"outDir": "./out",
"lib": [
"es5"
]
},
"exclude": [
"node_modules"
-5
View File
@@ -2,10 +2,5 @@
"name": "extension-editing",
"version": "0.0.1",
"dependencies": {
"typescript": {
"version": "1.8.10",
"from": "typescript@>=1.8.10 <2.0.0",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-1.8.10.tgz"
}
}
}
@@ -13,13 +13,9 @@
],
"main": "./out/extension",
"scripts": {
"postinstall": "node ./postinstall",
"compile": "gulp compile-extension:extension-editing",
"watch": "gulp watch-extension:extension-editing"
},
"dependencies": {
"typescript": "^1.8.10"
},
"contributes": {
"jsonValidation": [
{
@@ -1,23 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
const fs = require('fs');
const path = require('path');
// delete unused typescript stuff
const root = path.dirname(require.resolve('typescript'));
for (let name of fs.readdirSync(root)) {
if (name !== 'typescript.d.ts' && name !== 'typescript.js') {
try {
fs.unlinkSync(path.join(root, name));
console.log(`removed '${path.join(root, name)}'`);
} catch (e) {
console.warn(e);
}
}
}
@@ -83,7 +83,7 @@ namespace ast {
let end = Number.MAX_VALUE;
for (let name of dottedName.split('.')) {
let idx: number;
let idx: number = -1;
while ((idx = identifiers.indexOf(name, idx + 1)) >= 0) {
let myStart = spans[2 * idx];
let myEnd = spans[2 * idx + 1];
+1 -1
View File
@@ -1,7 +1,7 @@
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
[{
"name": "js-beautify",
"version": "1.6.2",
"version": "1.6.4",
"license": "MIT",
"repositoryURL": "https://github.com/beautify-web/js-beautify"
},{
+9 -12
View File
@@ -7,7 +7,7 @@
import * as path from 'path';
import { languages, workspace, ExtensionContext, IndentAction } from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, Range, RequestType, Protocol2Code } from 'vscode-languageclient';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, Range, RequestType } from 'vscode-languageclient';
import { EMPTY_ELEMENTS } from './htmlEmptyTagsShared';
import { activateColorDecorations } from './colorDecorators';
@@ -15,7 +15,7 @@ import * as nls from 'vscode-nls';
let localize = nls.loadMessageBundle();
namespace ColorSymbolRequest {
export const type: RequestType<string, Range[], any> = { get method() { return 'css/colorSymbols'; } };
export const type: RequestType<string, Range[], any, any> = { get method() { return 'css/colorSymbols'; }, _: null };
}
export function activate(context: ExtensionContext) {
@@ -50,17 +50,14 @@ export function activate(context: ExtensionContext) {
// Create the language client and start the client.
let client = new LanguageClient('html', localize('htmlserver.name', 'HTML Language Server'), serverOptions, clientOptions, true);
let disposable = client.start();
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context.subscriptions.push(disposable);
let colorRequestor = (uri: string) => {
return client.sendRequest(ColorSymbolRequest.type, uri).then(ranges => ranges.map(Protocol2Code.asRange));
};
disposable = activateColorDecorations(colorRequestor, { html: true, handlebars: true, razor: true });
context.subscriptions.push(disposable);
client.onReady().then(() => {
let colorRequestor = (uri: string) => {
return client.sendRequest(ColorSymbolRequest.type, uri).then(ranges => ranges.map(client.protocol2CodeConverter.asRange));
};
let disposable = activateColorDecorations(colorRequestor, { html: true, handlebars: true, razor: true });
context.subscriptions.push(disposable);
});
languages.setLanguageConfiguration('html', {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
+1 -6
View File
@@ -3,9 +3,4 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../../src/typings/mocha.d.ts'/>
/// <reference path='../../../../../extensions/node.d.ts'/>
/// <reference path='../../../../../extensions/lib.core.d.ts'/>
/// <reference path='../../../../../extensions/declares.d.ts'/>
/// <reference path='../../../node_modules/vscode-languageclient/lib/main.d.ts'/>
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
+5 -6
View File
@@ -1,11 +1,10 @@
{
"compilerOptions": {
"noLib": true,
"target": "es5",
"module": "commonjs",
"outDir": "./out"
},
"exclude": [
"node_modules"
]
"outDir": "./out",
"lib": [
"es5", "es2015.promise"
]
}
}
+7 -7
View File
@@ -3,19 +3,19 @@
"version": "0.1.0",
"dependencies": {
"vscode-jsonrpc": {
"version": "2.4.0",
"from": "vscode-jsonrpc@>=2.4.0 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-2.4.0.tgz"
"version": "3.0.1-alpha.2",
"from": "vscode-jsonrpc@>=3.0.1-alpha.2 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.0.1-alpha.2.tgz"
},
"vscode-languageclient": {
"version": "2.6.4-next.1",
"version": "3.0.1-alpha.2",
"from": "vscode-languageclient@next",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-2.6.4-next.1.tgz"
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-3.0.1-alpha.2.tgz"
},
"vscode-languageserver-types": {
"version": "1.0.5-next.1",
"version": "3.0.1-alpha.2",
"from": "vscode-languageserver-types@next",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.5-next.1.tgz"
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.1-alpha.2.tgz"
},
"vscode-nls": {
"version": "1.0.7",
+18 -14
View File
@@ -73,12 +73,12 @@
"html.format.enable": {
"type": "boolean",
"default": true,
"description": "Enable/disable default HTML formatter (requires restart)"
"description": "%html.format.enable.desc%"
},
"html.format.wrapLineLength": {
"type": "integer",
"default": 120,
"description": "Maximum amount of characters per line (0 = disable)."
"description": "%html.format.wrapLineLength.desc%"
},
"html.format.unformatted": {
"type": [
@@ -86,17 +86,17 @@
"null"
],
"default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, pre, q, samp, script, select, small, span, strong, sub, sup, textarea, tt, var",
"description": "List of tags, comma separated, that shouldn't be reformatted. 'null' defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content."
"description": "%html.format.unformatted.desc%"
},
"html.format.indentInnerHtml": {
"type": "boolean",
"default": false,
"description": "Indent <head> and <body> sections."
"description": "%html.format.indentInnerHtml.desc%"
},
"html.format.preserveNewLines": {
"type": "boolean",
"default": true,
"description": "Whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text."
"description": "%html.format.preserveNewLines.desc%"
},
"html.format.maxPreserveNewLines": {
"type": [
@@ -104,17 +104,17 @@
"null"
],
"default": null,
"description": "Maximum number of line breaks to be preserved in one chunk. Use 'null' for unlimited."
"description": "%html.format.maxPreserveNewLines.desc%"
},
"html.format.indentHandlebars": {
"type": "boolean",
"default": false,
"description": "Format and indent {{#foo}} and {{/foo}}."
"description": "%html.format.indentHandlebars.desc%"
},
"html.format.endWithNewline": {
"type": "boolean",
"default": false,
"description": "End with a newline."
"description": "%html.format.endWithNewline.desc%"
},
"html.format.extraLiners": {
"type": [
@@ -122,29 +122,33 @@
"null"
],
"default": "head, body, /html",
"description": "List of tags, comma separated, that should have an extra newline before them. 'null' defaults to \"head, body, /html\"."
"description": "%html.format.extraLiners.desc%"
},
"html.suggest.angular1": {
"type": "boolean",
"default": true,
"description": "Configures if the built-in HTML language support suggests Angular V1 tags and properties."
"description": "%html.suggest.angular1.desc%"
},
"html.suggest.ionic": {
"type": "boolean",
"default": true,
"description": "Configures if the built-in HTML language support suggests Ionic tags, properties and values."
"description": "%html.suggest.ionic.desc%"
},
"html.suggest.html5": {
"type": "boolean",
"default": true,
"description": "Configures if the built-in HTML language support suggests HTML5 tags, properties and values."
"description": "%html.suggest.html5.desc%"
}
}
}
},
"dependencies": {
"vscode-languageclient": "^2.6.4-next.1",
"vscode-languageserver-types": "^1.0.5-next.1",
"vscode-languageclient": "3.0.1-alpha.2",
"vscode-languageserver-types": "3.0.1-alpha.2",
"vscode-nls": "^1.0.7"
},
"devDependencies": {
"@types/node": "^6.0.51",
"@types/mocha": "^2.2.33"
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"html.format.enable.desc": "Enable/disable default HTML formatter (requires restart)",
"html.format.wrapLineLength.desc": "Maximum amount of characters per line (0 = disable).",
"html.format.unformatted.desc": "List of tags, comma separated, that shouldn't be reformatted. 'null' defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.",
"html.format.indentInnerHtml.desc": "Indent <head> and <body> sections.",
"html.format.preserveNewLines.desc": "Whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text.",
"html.format.maxPreserveNewLines.desc": "Maximum number of line breaks to be preserved in one chunk. Use 'null' for unlimited.",
"html.format.indentHandlebars.desc": "Format and indent {{#foo}} and {{/foo}}.",
"html.format.endWithNewline.desc": "End with a newline.",
"html.format.extraLiners.desc": "List of tags, comma separated, that should have an extra newline before them. 'null' defaults to \"head, body, /html\".",
"html.suggest.angular1.desc": "Configures if the built-in HTML language support suggests Angular V1 tags and properties.",
"html.suggest.ionic.desc": "Configures if the built-in HTML language support suggests Ionic tags, properties and values.",
"html.suggest.html5.desc":"Configures if the built-in HTML language support suggests HTML5 tags, properties and values."
}
@@ -0,0 +1,6 @@
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
[{
"name": "definitelytyped",
"repositoryURL": "https://github.com/DefinitelyTyped/DefinitelyTyped",
"license": "MIT"
}]
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -3,29 +3,29 @@
"version": "1.0.0",
"dependencies": {
"vscode-css-languageservice": {
"version": "2.0.0-next.3",
"version": "2.0.0-next.5",
"from": "vscode-css-languageservice@next",
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-2.0.0-next.3.tgz"
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-2.0.0-next.5.tgz"
},
"vscode-html-languageservice": {
"version": "1.0.1-next.4",
"version": "2.0.0-next.1",
"from": "vscode-html-languageservice@next",
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-1.0.1-next.4.tgz"
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-2.0.0-next.1.tgz"
},
"vscode-jsonrpc": {
"version": "2.4.0",
"from": "vscode-jsonrpc@>=2.4.0 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-2.4.0.tgz"
"version": "3.0.1-alpha.2",
"from": "vscode-jsonrpc@>=3.0.1-alpha.2 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.0.1-alpha.2.tgz"
},
"vscode-languageserver": {
"version": "2.6.2-next.1",
"version": "3.0.1-alpha.2",
"from": "vscode-languageserver@next",
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-2.6.2-next.1.tgz"
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.0.1-alpha.2.tgz"
},
"vscode-languageserver-types": {
"version": "1.0.5-next.1",
"from": "vscode-languageserver-types@>=1.0.5-next.1 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.5-next.1.tgz"
"version": "3.0.1-alpha.2",
"from": "vscode-languageserver-types@>=3.0.1-alpha.2 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.1-alpha.2.tgz"
},
"vscode-nls": {
"version": "1.0.7",
+10 -6
View File
@@ -8,15 +8,19 @@
"node": "*"
},
"dependencies": {
"vscode-css-languageservice": "^2.0.0-next.3",
"vscode-html-languageservice": "^1.0.1-next.4",
"vscode-languageserver": "^2.6.2-next.1",
"vscode-nls": "^1.0.4",
"vscode-css-languageservice": "^2.0.0-next.5",
"vscode-html-languageservice": "^2.0.0-next.1",
"vscode-languageserver": "3.0.1-alpha.2",
"vscode-nls": "^1.0.7",
"vscode-uri": "^1.0.0"
},
"devDependencies": {
"@types/node": "^6.0.51",
"@types/mocha": "^2.2.33"
},
"scripts": {
"compile": "gulp compile-extension:json-server",
"watch": "gulp watch-extension:json-server",
"compile": "gulp compile-extension:html-server",
"watch": "gulp watch-extension:html-server",
"install-service-next": "npm install vscode-css-languageservice@next -f -S && npm install vscode-html-languageservice@next -f -S",
"install-service-local": "npm install ../../../../vscode-css-languageservice -f -S && npm install ../../../../vscode-html-languageservice -f -S",
"install-server-next": "npm install vscode-languageserver@next -f -S",
+15 -2
View File
@@ -5,7 +5,8 @@
'use strict';
import { createConnection, IConnection, TextDocuments, InitializeParams, InitializeResult, RequestType } from 'vscode-languageserver';
import { DocumentContext, TextDocument, Diagnostic, DocumentLink, Range, TextEdit } from 'vscode-html-languageservice';
import { DocumentContext } from 'vscode-html-languageservice';
import { TextDocument, Diagnostic, DocumentLink, Range, TextEdit, SymbolInformation } from 'vscode-languageserver-types';
import { getLanguageModes, LanguageModes } from './modes/languageModes';
import * as url from 'url';
@@ -16,7 +17,7 @@ import * as nls from 'vscode-nls';
nls.config(process.env['VSCODE_NLS_CONFIG']);
namespace ColorSymbolRequest {
export const type: RequestType<string, Range[], any> = { get method() { return 'css/colorSymbols'; } };
export const type: RequestType<string, Range[], any, any> = { get method() { return 'css/colorSymbols'; }, _: null };
}
// Create a connection for the server
@@ -59,6 +60,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
documentHighlightProvider: true,
documentRangeFormattingProvider: initializationOptions && initializationOptions['format.enable'],
documentLinkProvider: true,
documentSymbolProvider: true,
definitionProvider: true,
signatureHelpProvider: { triggerCharacters: ['('] },
referencesProvider: true
@@ -225,6 +227,17 @@ connection.onDocumentLinks(documentLinkParam => {
return links;
});
connection.onDocumentSymbol(documentSymbolParms => {
let document = documents.get(documentSymbolParms.textDocument.uri);
let symbols: SymbolInformation[] = [];
languageModes.getAllModesInDocument(document).forEach(m => {
if (m.findDocumentSymbols) {
pushAll(symbols, m.findDocumentSymbols(document));
}
});
return symbols;
});
connection.onRequest(ColorSymbolRequest.type, uri => {
let ranges: Range[] = [];
let document = documents.get(uri);
+9 -1
View File
@@ -8,9 +8,11 @@ import { LanguageModelCache, getLanguageModelCache } from '../languageModelCache
import { TextDocument, Position } from 'vscode-languageserver-types';
import { getCSSLanguageService, Stylesheet } from 'vscode-css-languageservice';
import { LanguageMode } from './languageModes';
import { HTMLDocumentRegions, CSS_STYLE_RULE } from './embeddedSupport';
export function getCSSMode(embeddedCSSDocuments: LanguageModelCache<TextDocument>): LanguageMode {
export function getCSSMode(documentRegions: LanguageModelCache<HTMLDocumentRegions>): LanguageMode {
let cssLanguageService = getCSSLanguageService();
let embeddedCSSDocuments = getLanguageModelCache<TextDocument>(10, 60, document => documentRegions.get(document).getEmbeddedDocument('css'));
let cssStylesheets = getLanguageModelCache<Stylesheet>(10, 60, document => cssLanguageService.parseStylesheet(document));
return {
@@ -36,6 +38,10 @@ export function getCSSMode(embeddedCSSDocuments: LanguageModelCache<TextDocument
let embedded = embeddedCSSDocuments.get(document);
return cssLanguageService.findDocumentHighlights(embedded, position, cssStylesheets.get(embedded));
},
findDocumentSymbols(document: TextDocument) {
let embedded = embeddedCSSDocuments.get(document);
return cssLanguageService.findDocumentSymbols(embedded, cssStylesheets.get(embedded)).filter(s => s.name !== CSS_STYLE_RULE);
},
findDefinition(document: TextDocument, position: Position) {
let embedded = embeddedCSSDocuments.get(document);
return cssLanguageService.findDefinition(embedded, position, cssStylesheets.get(embedded));
@@ -49,9 +55,11 @@ export function getCSSMode(embeddedCSSDocuments: LanguageModelCache<TextDocument
return cssLanguageService.findColorSymbols(embedded, cssStylesheets.get(embedded));
},
onDocumentRemoved(document: TextDocument) {
embeddedCSSDocuments.onDocumentRemoved(document);
cssStylesheets.onDocumentRemoved(document);
},
dispose() {
embeddedCSSDocuments.dispose();
cssStylesheets.dispose();
}
};
@@ -17,20 +17,80 @@ export interface HTMLDocumentRegions {
getLanguageRanges(range: Range): LanguageRange[];
getLanguageAtPosition(position: Position): string;
getLanguagesInDocument(): string[];
getImportedScripts(): string[];
}
export var CSS_STYLE_RULE = '__';
interface EmbeddedRegion { languageId: string; start: number; end: number; attributeValue?: boolean; };
export function getDocumentRegions(languageService: LanguageService, document: TextDocument): HTMLDocumentRegions {
let regions = getEmbeddedRegions(languageService, document);
let regions: EmbeddedRegion[] = [];
let scanner = languageService.createScanner(document.getText());
let lastTagName: string;
let lastAttributeName: string;
let languageIdFromType: string;
let importedScripts = [];
let token = scanner.scan();
while (token !== TokenType.EOS) {
switch (token) {
case TokenType.StartTag:
lastTagName = scanner.getTokenText();
lastAttributeName = null;
languageIdFromType = 'javascript';
break;
case TokenType.Styles:
regions.push({ languageId: 'css', start: scanner.getTokenOffset(), end: scanner.getTokenEnd() });
break;
case TokenType.Script:
regions.push({ languageId: languageIdFromType, start: scanner.getTokenOffset(), end: scanner.getTokenEnd() });
break;
case TokenType.AttributeName:
lastAttributeName = scanner.getTokenText();
break;
case TokenType.AttributeValue:
if (lastAttributeName === 'src' && lastTagName.toLowerCase() === 'script') {
let value = scanner.getTokenText();
if (value[0] === '\'' || value[0] === '"') {
value = value.substr(1, value.length - 1);
}
importedScripts.push(value);
} else if (lastAttributeName === 'type' && lastTagName.toLowerCase() === 'script') {
if (/["'](text|application)\/(java|ecma)script["']/.test(scanner.getTokenText())) {
languageIdFromType = 'javascript';
} else {
languageIdFromType = void 0;
}
} else {
let attributelLanguageId = getAttributeLanguage(lastAttributeName);
if (attributelLanguageId) {
let start = scanner.getTokenOffset();
let end = scanner.getTokenEnd();
let firstChar = document.getText()[start];
if (firstChar === '\'' || firstChar === '"') {
start++;
end--;
}
regions.push({ languageId: attributelLanguageId, start, end, attributeValue: true });
}
}
lastAttributeName = null;
break;
}
token = scanner.scan();
}
return {
getLanguageRanges: (range: Range) => getLanguageRanges(document, regions, range),
getEmbeddedDocument: (languageId: string) => getEmbeddedDocument(document, regions, languageId),
getLanguageAtPosition: (position: Position) => getLanguageAtPosition(document, regions, position),
getLanguagesInDocument: () => getLanguagesInDocument(document, regions)
getLanguagesInDocument: () => getLanguagesInDocument(document, regions),
getImportedScripts: () => importedScripts
};
}
function getLanguageRanges(document: TextDocument, regions: EmbeddedRegion[], range: Range): LanguageRange[] {
let result: LanguageRange[] = [];
let currentPos = range ? range.start : Position.create(0, 0);
@@ -120,7 +180,7 @@ function getEmbeddedDocument(document: TextDocument, contents: EmbeddedRegion[],
function getPrefix(c: EmbeddedRegion) {
if (c.attributeValue) {
switch (c.languageId) {
case 'css': return 'x{';
case 'css': return CSS_STYLE_RULE + '{';
}
}
return '';
@@ -164,60 +224,8 @@ function append(result: string, str: string, n: number): string {
return result;
}
function getEmbeddedRegions(languageService: LanguageService, document: TextDocument): EmbeddedRegion[] {
let regions: EmbeddedRegion[] = [];
let scanner = languageService.createScanner(document.getText());
let lastTagName: string;
let lastAttributeName: string;
let languageIdFromType: string;
let token = scanner.scan();
while (token !== TokenType.EOS) {
switch (token) {
case TokenType.StartTag:
lastTagName = scanner.getTokenText();
lastAttributeName = null;
languageIdFromType = 'javascript';
break;
case TokenType.Styles:
regions.push({ languageId: 'css', start: scanner.getTokenOffset(), end: scanner.getTokenEnd() });
break;
case TokenType.Script:
regions.push({ languageId: languageIdFromType, start: scanner.getTokenOffset(), end: scanner.getTokenEnd() });
break;
case TokenType.AttributeName:
lastAttributeName = scanner.getTokenText();
break;
case TokenType.AttributeValue:
if (lastAttributeName === 'type' && lastTagName.toLowerCase() === 'script') {
if (/["'](text|application)\/(java|ecma)script["']/.test(scanner.getTokenText())) {
languageIdFromType = 'javascript';
} else {
languageIdFromType = void 0;
}
} else {
let attributelLanguageId = getAttributeLanguage(lastAttributeName);
if (attributelLanguageId) {
let start = scanner.getTokenOffset();
let end = scanner.getTokenEnd();
let firstChar = document.getText()[start];
if (firstChar === '\'' || firstChar === '"') {
start++;
end--;
}
regions.push({ languageId: attributelLanguageId, start, end, attributeValue: true });
}
}
lastAttributeName = null;
break;
}
token = scanner.scan();
}
return regions;
}
function getAttributeLanguage(attributeName: string): string {
let match = attributeName.match(/^(style)|(on\w+)$/i);
let match = attributeName.match(/^(style)$|^(on\w+)$/i);
if (!match) {
return null;
}
@@ -4,36 +4,36 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { LanguageModelCache } from '../languageModelCache';
import { CompletionItem, Location, SignatureHelp, SignatureInformation, ParameterInformation, Definition, TextEdit, TextDocument, Diagnostic, DiagnosticSeverity, Range, CompletionItemKind, Hover, MarkedString, DocumentHighlight, DocumentHighlightKind, CompletionList, Position, FormattingOptions } from 'vscode-languageserver-types';
import { LanguageModelCache, getLanguageModelCache } from '../languageModelCache';
import { SymbolInformation, SymbolKind, CompletionItem, Location, SignatureHelp, SignatureInformation, ParameterInformation, Definition, TextEdit, TextDocument, Diagnostic, DiagnosticSeverity, Range, CompletionItemKind, Hover, MarkedString, DocumentHighlight, DocumentHighlightKind, CompletionList, Position, FormattingOptions } from 'vscode-languageserver-types';
import { LanguageMode } from './languageModes';
import { getWordAtText } from '../utils/words';
import { HTMLDocumentRegions } from './embeddedSupport';
import ts = require('./typescript/typescriptServices');
import { contents as libdts } from './typescript/lib-ts';
import * as ts from 'typescript';
import { join } from 'path';
const DEFAULT_LIB = {
NAME: 'defaultLib:lib.d.ts',
CONTENTS: libdts
};
const FILE_NAME = 'typescript://singlefile/1'; // the same 'file' is used for all contents
const FILE_NAME = 'vscode://javascript/1'; // the same 'file' is used for all contents
const JQUERY_D_TS = join(__dirname, '../../lib/jquery.d.ts');
const JS_WORD_REGEX = /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g;
export function getJavascriptMode(jsDocuments: LanguageModelCache<TextDocument>): LanguageMode {
export function getJavascriptMode(documentRegions: LanguageModelCache<HTMLDocumentRegions>): LanguageMode {
let jsDocuments = getLanguageModelCache<TextDocument>(10, 60, document => documentRegions.get(document).getEmbeddedDocument('javascript'));
let compilerOptions = { allowNonTsExtensions: true, allowJs: true, target: ts.ScriptTarget.Latest };
let currentTextDocument: TextDocument;
let host = {
getCompilationSettings: () => compilerOptions,
getScriptFileNames: () => [FILE_NAME],
getScriptFileNames: () => [FILE_NAME, JQUERY_D_TS],
getScriptVersion: (fileName: string) => {
if (fileName === FILE_NAME) {
return String(currentTextDocument.version);
}
return '1'; // default lib is static
return '1'; // default lib an jquery.d.ts are static
},
getScriptSnapshot: (fileName: string) => {
let text = fileName === FILE_NAME ? currentTextDocument.getText() : DEFAULT_LIB.CONTENTS;
let text = fileName === FILE_NAME ? currentTextDocument.getText() : ts.sys.readFile(fileName);
return {
getText: (start, end) => text.substring(start, end),
getLength: () => text.length,
@@ -41,7 +41,7 @@ export function getJavascriptMode(jsDocuments: LanguageModelCache<TextDocument>)
};
},
getCurrentDirectory: () => '',
getDefaultLibFileName: options => DEFAULT_LIB.NAME
getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options)
};
let jsLanguageService = ts.createLanguageService(host);
@@ -164,6 +164,42 @@ export function getJavascriptMode(jsDocuments: LanguageModelCache<TextDocument>)
};
return null;
},
findDocumentSymbols(document: TextDocument): SymbolInformation[] {
currentTextDocument = jsDocuments.get(document);
let items = jsLanguageService.getNavigationBarItems(FILE_NAME);
if (items) {
let result: SymbolInformation[] = [];
let existing = {};
let collectSymbols = (item: ts.NavigationBarItem, containerLabel?: string) => {
let sig = item.text + item.kind + item.spans[0].start;
if (item.kind !== 'script' && !existing[sig]) {
let symbol: SymbolInformation = {
name: item.text,
kind: convertSymbolKind(item.kind),
location: {
uri: document.uri,
range: convertRange(currentTextDocument, item.spans[0])
},
containerName: containerLabel
};
existing[sig] = true;
result.push(symbol);
containerLabel = item.text;
}
if (item.childItems && item.childItems.length > 0) {
for (let child of item.childItems) {
collectSymbols(child, containerLabel);
}
}
};
items.forEach(item => collectSymbols(item));
return result;
}
return null;
},
findDefinition(document: TextDocument, position: Position): Definition {
currentTextDocument = jsDocuments.get(document);
let definition = jsLanguageService.getDefinitionAtPosition(FILE_NAME, currentTextDocument.offsetAt(position));
@@ -212,9 +248,11 @@ export function getJavascriptMode(jsDocuments: LanguageModelCache<TextDocument>)
return null;
},
onDocumentRemoved(document: TextDocument) {
jsDocuments.onDocumentRemoved(document);
},
dispose() {
jsLanguageService.dispose();
jsDocuments.dispose();
}
};
};
@@ -258,6 +296,33 @@ function convertKind(kind: string): CompletionItemKind {
return CompletionItemKind.Property;
}
function convertSymbolKind(kind: string): SymbolKind {
switch (kind) {
case 'var':
case 'local var':
case 'const':
return SymbolKind.Variable;
case 'function':
case 'local function':
return SymbolKind.Function;
case 'enum':
return SymbolKind.Enum;
case 'module':
return SymbolKind.Module;
case 'class':
return SymbolKind.Class;
case 'interface':
return SymbolKind.Interface;
case 'method':
return SymbolKind.Method;
case 'property':
case 'getter':
case 'setter':
return SymbolKind.Property;
}
return SymbolKind.Variable;
}
function convertOptions(options: FormattingOptions, formatSettings: any, initialIndentLevel: number): ts.FormatCodeOptions {
return {
ConvertTabsToSpaces: options.insertSpaces,
@@ -7,7 +7,7 @@
import { getLanguageService as getHTMLLanguageService, DocumentContext } from 'vscode-html-languageservice';
import {
CompletionItem, Location, SignatureHelp, Definition, TextEdit, TextDocument, Diagnostic, DocumentLink, Range,
Hover, DocumentHighlight, CompletionList, Position, FormattingOptions
Hover, DocumentHighlight, CompletionList, Position, FormattingOptions, SymbolInformation
} from 'vscode-languageserver-types';
import { getLanguageModelCache, LanguageModelCache } from '../languageModelCache';
@@ -25,6 +25,7 @@ export interface LanguageMode {
doHover?: (document: TextDocument, position: Position) => Hover;
doSignatureHelp?: (document: TextDocument, position: Position) => SignatureHelp;
findDocumentHighlight?: (document: TextDocument, position: Position) => DocumentHighlight[];
findDocumentSymbols?: (document: TextDocument) => SymbolInformation[];
findDocumentLinks?: (document: TextDocument, documentContext: DocumentContext) => DocumentLink[];
findDefinition?: (document: TextDocument, position: Position) => Definition;
findReferences?: (document: TextDocument, position: Position) => Location[];
@@ -60,14 +61,10 @@ export function getLanguageModes(supportedLanguages: { [languageId: string]: boo
let modes = {};
modes['html'] = getHTMLMode(htmlLanguageService);
if (supportedLanguages['css']) {
let embeddedCSSDocuments = getLanguageModelCache<TextDocument>(10, 60, document => documentRegions.get(document).getEmbeddedDocument('css'));
modelCaches.push(embeddedCSSDocuments);
modes['css'] = getCSSMode(embeddedCSSDocuments);
modes['css'] = getCSSMode(documentRegions);
}
if (supportedLanguages['javascript']) {
let embeddedJSDocuments = getLanguageModelCache<TextDocument>(10, 60, document => documentRegions.get(document).getEmbeddedDocument('javascript'));
modelCaches.push(embeddedJSDocuments);
modes['javascript'] = getJavascriptMode(embeddedJSDocuments);
modes['javascript'] = getJavascriptMode(documentRegions);
}
return {
getModeAtPosition(document: TextDocument, position: Position): LanguageMode {
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -67,8 +67,8 @@ suite('HTML Embedded Support', () => {
assertEmbeddedLanguageContent('<html><style>foo { }</style>Hello<style>foo { }</style></html>', 'css', ' foo { } foo { } ');
assertEmbeddedLanguageContent('<html>\n <style>\n foo { } \n </style>\n</html>\n', 'css', '\n \n foo { } \n \n\n');
assertEmbeddedLanguageContent('<div style="color: red"></div>', 'css', ' x{color: red} ');
assertEmbeddedLanguageContent('<div style=color:red></div>', 'css', ' x{color:red} ');
assertEmbeddedLanguageContent('<div style="color: red"></div>', 'css', ' __{color: red} ');
assertEmbeddedLanguageContent('<div style=color:red></div>', 'css', ' __{color:red} ');
});
test('Scripts', function (): any {
@@ -106,6 +106,9 @@ suite('HTML Embedded Support', () => {
assertLanguageId('<DIV ONKEYUP=foo(|)</DIV>', 'javascript');
assertLanguageId('<DIV ONKEYUP=foo()|</DIV>', 'javascript');
assertLanguageId('<DIV ONKEYUP=foo()<|/DIV>', 'html');
assertLanguageId('<label data-content="|Checkbox"/>', 'html');
assertLanguageId('<label on="|Checkbox"/>', 'html');
});
test('Script content', function (): any {
@@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import { getJavascriptMode } from '../modes/javascriptMode';
import { TextDocument, Range, TextEdit, FormattingOptions } from 'vscode-languageserver-types';
import { getLanguageModelCache } from '../languageModelCache';
import { getLanguageService } from 'vscode-html-languageservice';
import * as embeddedSupport from '../modes/embeddedSupport';
suite('HTML Javascript Support', () => {
var htmlLanguageService = getLanguageService();
function assertCompletions(value: string, expectedProposals: string[]): void {
let offset = value.indexOf('|');
value = value.substr(0, offset) + value.substr(offset + 1);
let document = TextDocument.create('test://test/test.html', 'html', 0, value);
let documentRegions = getLanguageModelCache<embeddedSupport.HTMLDocumentRegions>(10, 60, document => embeddedSupport.getDocumentRegions(htmlLanguageService, document));
var mode = getJavascriptMode(documentRegions);
let position = document.positionAt(offset);
let list = mode.doComplete(document, position);
assert.ok(list);
let actualLabels = list.items.map(c => c.label).sort();
for (let expected of expectedProposals) {
assert.ok(actualLabels.indexOf(expected) !== -1, 'Not found:' + expected + ' is ' + actualLabels.join(', '));
}
}
test('Completions', function (): any {
assertCompletions('<html><script>window.|</script></html>', ['location']);
assertCompletions('<html><script>$.|</script></html>', ['getJSON']);
});
});
+1
View File
@@ -0,0 +1 @@
/// <reference path='../../node_modules/@types/mocha/index.d.ts'/>
-112
View File
@@ -1,112 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/**
* The Thenable (E.g. PromiseLike) and Promise declarions are taken from TypeScript's
* lib.core.es6.d.ts file. See above Copyright notice.
*/
/**
* Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
* and others. This API makes no assumption about what promise libary is being used which
* enables reusing existing code without migrating to a specific promise implementation. Still,
* we recommand the use of native promises which are available in VS Code.
*/
interface Thenable<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
}
/**
* Represents the completion of an asynchronous operation
*/
interface Promise<T> extends Thenable<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Promise<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
/**
* Attaches a callback for only the rejection of the Promise.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of the callback.
*/
catch(onrejected?: (reason: any) => T | Thenable<T>): Promise<T>;
}
interface PromiseConstructor {
/**
* Creates a new Promise.
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
new <T>(executor: (resolve: (value?: T | Thenable<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T>(values: Array<T | Thenable<T>>): Promise<T[]>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T>(values: Array<T | Thenable<T>>): Promise<T>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject(reason: any): Promise<void>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject<T>(reason: any): Promise<T>;
/**
* Creates a new resolved promise for the provided value.
* @param value A promise.
* @returns A promise whose internal state matches the provided promise.
*/
resolve<T>(value: T | Thenable<T>): Promise<T>;
/**
* Creates a new resolved promise .
* @returns A resolved promise.
*/
resolve(): Promise<void>;
}
declare var Promise: PromiseConstructor;
+5 -6
View File
@@ -1,11 +1,10 @@
{
"compilerOptions": {
"noLib": true,
"target": "es5",
"module": "commonjs",
"outDir": "./out"
},
"exclude": [
"node_modules"
]
"outDir": "./out",
"lib": [
"es5", "es2015.promise"
]
}
}
+20
View File
@@ -19,4 +19,24 @@
"to the base-name name of the original file, and an extension of txt, html, or similar. For example",
"\"tidy\" is accompanied by \"tidy-license.txt\"."
]
},{
"name": "textmate/javadoc.tmbundle",
"version": "0.0.0",
"license": "TextMate Bundle License",
"repositoryURL": "https://github.com/textmate/javadoc.tmbundle",
"licenseDetail": [
"Copyright (c) textmate-javadoc.tmbundle project authors",
"",
"If not otherwise specified (see below), files in this repository fall under the following license:",
"",
"Permission to copy, use, modify, sell and distribute this",
"software is granted. This software is provided \"as is\" without",
"express or implied warranty, and with no claim as to its",
"suitability for any purpose.",
"",
"An exception is made for files in readable text which contain their own license information,",
"or files where an accompanying file exists (in the same directory) with a \"-license\" suffix added",
"to the base-name name of the original file, and an extension of txt, html, or similar. For example",
"\"tidy\" is accompanied by \"tidy-license.txt\"."
]
}]
+5 -2
View File
@@ -4,7 +4,7 @@
"publisher": "vscode",
"engines": { "vscode": "*" },
"scripts": {
"update-grammar": "node ../../build/npm/update-grammar.js textmate/java.tmbundle Syntaxes/Java.plist ./syntaxes/java.json"
"update-grammar": "node ../../build/npm/update-grammar.js textmate/java.tmbundle Syntaxes/Java.plist ./syntaxes/java.tmLanguage.json && node ../../build/npm/update-grammar.js textmate/javadoc.tmbundle Syntaxes/JavaDoc.tmLanguage ./syntaxes/javadoc.tmLanguage.json"
},
"contributes": {
"languages": [{
@@ -16,7 +16,10 @@
"grammars": [{
"language": "java",
"scopeName": "source.java",
"path": "./syntaxes/java.json"
"path": "./syntaxes/java.tmLanguage.json"
},{
"scopeName": "text.html.javadoc",
"path": "./syntaxes/javadoc.tmLanguage.json"
}]
}
}
@@ -0,0 +1,432 @@
{
"fileTypes": [],
"name": "JavaDoc",
"patterns": [
{
"begin": "(/\\*\\*)\\s*$",
"beginCaptures": {
"1": {
"name": "punctuation.definition.comment.begin.javadoc"
}
},
"contentName": "text.html",
"end": "\\*/",
"endCaptures": {
"0": {
"name": "punctuation.definition.comment.end.javadoc"
}
},
"name": "comment.block.documentation.javadoc",
"patterns": [
{
"include": "#inline"
},
{
"begin": "((\\@)param)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.param.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.param.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "((\\@)return)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.return.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.return.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "((\\@)throws)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.throws.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.throws.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "((\\@)exception)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.exception.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.exception.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "((\\@)author)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.author.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.author.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "((\\@)version)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.version.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.version.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "((\\@)see)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.see.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.see.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "((\\@)since)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.since.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.since.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "((\\@)serial)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.serial.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.serial.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "((\\@)serialField)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.serialField.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.serialField.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "((\\@)serialData)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.serialData.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.serialData.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "((\\@)deprecated)",
"beginCaptures": {
"1": {
"name": "keyword.other.documentation.deprecated.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"end": "(?=^\\s*\\*?\\s*@|\\*/)",
"name": "meta.documentation.tag.deprecated.javadoc",
"patterns": [
{
"include": "#inline"
}
]
},
{
"captures": {
"1": {
"name": "keyword.other.documentation.custom.javadoc"
},
"2": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"match": "((\\@)\\S+)\\s"
}
]
}
],
"repository": {
"inline": {
"patterns": [
{
"include": "#inline-formatting"
},
{
"comment": "This prevents < characters in commented source from starting\n\t\t\t\t\t\t\t\ta tag that will not end. List of allowed tags taken from\n\t\t\t\t\t\t\t\tjava checkstyle.",
"match": "<(?!(a|abbr|acronym|address|area|b|bdo|big|blockquote|br|caption|cite|code|colgroup|dd|del|div|dfn|dl|dt|em|fieldset|font|h1toh6|hr|i|img|ins|kbd|li|ol|p|pre|q|samp|small|span|strong|sub|sup|table|tbody|td|tfoot|th|thread|tr|tt|u|ul)\\b[^>]*>)"
},
{
"include": "text.html.basic"
},
{
"match": "((https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt)://|mailto:)[-:@a-zA-Z0-9_.,~%+/?=&#;]+(?<![-.,?:#;])",
"name": "markup.underline.link"
}
]
},
"inline-formatting": {
"patterns": [
{
"begin": "(\\{)((\\@)code)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.javadoc"
},
"2": {
"name": "keyword.other.documentation.directive.code.javadoc"
},
"3": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"contentName": "markup.raw.code.javadoc",
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.tag.end.javadoc"
}
},
"name": "meta.tag.template.code.javadoc",
"patterns": []
},
{
"begin": "(\\{)((\\@)literal)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.javadoc"
},
"2": {
"name": "keyword.other.documentation.directive.literal.javadoc"
},
"3": {
"name": "punctuation.definition.keyword.javadoc"
}
},
"contentName": "markup.raw.literal.javadoc",
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.tag.end.javadoc"
}
},
"name": "meta.tag.template.literal.javadoc",
"patterns": []
},
{
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.javadoc"
},
"2": {
"name": "keyword.other.documentation.directive.docRoot.javadoc"
},
"3": {
"name": "punctuation.definition.keyword.javadoc"
},
"4": {
"name": "punctuation.definition.tag.end.javadoc"
}
},
"match": "(\\{)((\\@)docRoot)(\\})",
"name": "meta.tag.template.docRoot.javadoc"
},
{
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.javadoc"
},
"2": {
"name": "keyword.other.documentation.directive.inheritDoc.javadoc"
},
"3": {
"name": "punctuation.definition.keyword.javadoc"
},
"4": {
"name": "punctuation.definition.tag.end.javadoc"
}
},
"match": "(\\{)((\\@)inheritDoc)(\\})",
"name": "meta.tag.template.inheritDoc.javadoc"
},
{
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.javadoc"
},
"2": {
"name": "keyword.other.documentation.directive.link.javadoc"
},
"3": {
"name": "punctuation.definition.keyword.javadoc"
},
"4": {
"name": "markup.underline.link.javadoc"
},
"5": {
"name": "string.other.link.title.javadoc"
},
"6": {
"name": "punctuation.definition.tag.end.javadoc"
}
},
"match": "(\\{)((\\@)link)(?:\\s+(\\S+?))?(?:\\s+(.+?))?\\s*(\\})",
"name": "meta.tag.template.link.javadoc"
},
{
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.javadoc"
},
"2": {
"name": "keyword.other.documentation.directive.linkplain.javadoc"
},
"3": {
"name": "punctuation.definition.keyword.javadoc"
},
"4": {
"name": "markup.underline.linkplain.javadoc"
},
"5": {
"name": "string.other.link.title.javadoc"
},
"6": {
"name": "punctuation.definition.tag.end.javadoc"
}
},
"match": "(\\{)((\\@)linkplain)(?:\\s+(\\S+?))?(?:\\s+(.+?))?\\s*(\\})",
"name": "meta.tag.template.linkplain.javadoc"
},
{
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.javadoc"
},
"2": {
"name": "keyword.other.documentation.directive.value.javadoc"
},
"3": {
"name": "punctuation.definition.keyword.javadoc"
},
"4": {
"name": "variable.other.javadoc"
},
"5": {
"name": "punctuation.definition.tag.end.javadoc"
}
},
"match": "(\\{)((\\@)value)\\s*(\\S+?)?\\s*(\\})",
"name": "meta.tag.template.value.javadoc"
}
]
}
},
"scopeName": "text.html.javadoc",
"uuid": "64BB98A4-59D4-474E-9091-C1E1D04BDD03",
"version": "https://github.com/textmate/javadoc.tmbundle/commit/5276d7a93f0cf53b7d425c39c6968b09ea9f2d40"
}
@@ -440,8 +440,8 @@
}
},
{
"c": "/*",
"t": "block.body.class.comment.definition.java.meta.punctuation",
"c": "/**",
"t": "begin.block.body.class.comment.definition.documentation.java.javadoc.meta.punctuation",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.comment rgb(96, 139, 78)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.comment rgb(0, 128, 0)",
@@ -451,8 +451,8 @@
}
},
{
"c": "*",
"t": "block.body.class.comment.java.meta",
"c": "\t * ",
"t": "block.body.class.comment.documentation.html.java.javadoc.meta.text",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.comment rgb(96, 139, 78)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.comment rgb(0, 128, 0)",
@@ -462,8 +462,30 @@
}
},
{
"c": "\t * @param args",
"t": "block.body.class.comment.java.meta",
"c": "@",
"t": "block.body.class.comment.definition.documentation.html.java.javadoc.keyword.meta.other.param.punctuation.tag.text",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.punctuation.definition.tag rgb(128, 128, 128)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.punctuation.definition.tag rgb(128, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.punctuation.definition.tag rgb(128, 128, 128)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.punctuation.definition.tag rgb(128, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.punctuation.definition.tag rgb(128, 128, 128)"
}
},
{
"c": "param",
"t": "block.body.class.comment.documentation.html.java.javadoc.keyword.meta.other.param.tag.text",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword rgb(86, 156, 214)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword rgb(0, 0, 255)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword rgb(86, 156, 214)"
}
},
{
"c": " args",
"t": "block.body.class.comment.documentation.html.java.javadoc.meta.param.tag.text",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.comment rgb(96, 139, 78)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.comment rgb(0, 128, 0)",
@@ -474,7 +496,7 @@
},
{
"c": "\t ",
"t": "block.body.class.comment.java.meta",
"t": "block.body.class.comment.documentation.html.java.javadoc.meta.param.tag.text",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.comment rgb(96, 139, 78)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.comment rgb(0, 128, 0)",
@@ -485,7 +507,7 @@
},
{
"c": "*/",
"t": "block.body.class.comment.definition.java.meta.punctuation",
"t": "block.body.class.comment.definition.documentation.end.java.javadoc.meta.punctuation",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.comment rgb(96, 139, 78)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.comment rgb(0, 128, 0)",
@@ -12,8 +12,8 @@
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'", "notIn": ["string"] },
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "\"", "close": "\"", "notIn": ["string"] },
{ "open": "`", "close": "`", "notIn": ["string", "comment"] },
{ "open": "/**", "close": " */", "notIn": ["string"] }
],
@@ -117,7 +117,7 @@ export class BowerJSONContribution implements IJSONContribution {
if ((location.matches(['dependencies', '*']) || location.matches(['devDependencies', '*']))) {
// not implemented. Could be do done calling the bower command. Waiting for web API: https://github.com/bower/registry/issues/26
let proposal = new CompletionItem(localize('json.bower.latest.version', 'latest'));
proposal.insertText = '"{{latest}}"';
proposal.insertText = new SnippetString('"${1:latest}"');
proposal.filterText = '""';
proposal.kind = CompletionItemKind.Value;
proposal.documentation = 'The latest version of the package';
+20 -19
View File
@@ -14,7 +14,7 @@ import * as nls from 'vscode-nls';
let localize = nls.loadMessageBundle();
namespace VSCodeContentRequest {
export const type: RequestType<string, string, any> = { get method() { return 'vscode/content'; } };
export const type: RequestType<string, string, any, any> = { get method() { return 'vscode/content'; }, _: null };
}
export interface ISchemaAssociations {
@@ -22,7 +22,7 @@ export interface ISchemaAssociations {
}
namespace SchemaAssociationNotification {
export const type: NotificationType<ISchemaAssociations> = { get method() { return 'json/schemaAssociations'; } };
export const type: NotificationType<ISchemaAssociations, any> = { get method() { return 'json/schemaAssociations'; }, _: null };
}
interface IPackageInfo {
@@ -68,25 +68,26 @@ export function activate(context: ExtensionContext) {
// Create the language client and start the client.
let client = new LanguageClient('json', localize('jsonserver.name', 'JSON Language Server'), serverOptions, clientOptions);
client.onTelemetry(e => {
if (telemetryReporter) {
telemetryReporter.sendTelemetryEvent(e.key, e.data);
}
});
// handle content request
client.onRequest(VSCodeContentRequest.type, (uriPath: string) => {
let uri = Uri.parse(uriPath);
return workspace.openTextDocument(uri).then(doc => {
return doc.getText();
}, error => {
return Promise.reject(error);
});
});
let disposable = client.start();
client.onReady().then(() => {
client.onTelemetry(e => {
if (telemetryReporter) {
telemetryReporter.sendTelemetryEvent(e.key, e.data);
}
});
client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociation(context));
// handle content request
client.onRequest(VSCodeContentRequest.type, (uriPath: string) => {
let uri = Uri.parse(uriPath);
return workspace.openTextDocument(uri).then(doc => {
return doc.getText();
}, error => {
return Promise.reject(error);
});
});
client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociation(context));
});
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
+1 -6
View File
@@ -3,9 +3,4 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../../src/typings/mocha.d.ts'/>
/// <reference path='../../../../../extensions/node.d.ts'/>
/// <reference path='../../../../../extensions/lib.core.d.ts'/>
/// <reference path='../../../../../extensions/declares.d.ts'/>
/// <reference path='../../../node_modules/vscode-languageclient/lib/main.d.ts'/>
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
+5 -6
View File
@@ -1,11 +1,10 @@
{
"compilerOptions": {
"noLib": true,
"target": "es5",
"module": "commonjs",
"outDir": "./out"
},
"exclude": [
"node_modules"
]
"outDir": "./out",
"lib": [
"es5", "es2015.promise"
]
}
}
+8 -8
View File
@@ -13,19 +13,19 @@
"resolved": "https://registry.npmjs.org/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.5.tgz"
},
"vscode-jsonrpc": {
"version": "2.3.2-next.5",
"from": "vscode-jsonrpc@>=2.3.2-next.2 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-2.3.2-next.5.tgz"
"version": "3.0.1-alpha.2",
"from": "vscode-jsonrpc@>=3.0.1-alpha.2 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.0.1-alpha.2.tgz"
},
"vscode-languageclient": {
"version": "2.4.2-next.22",
"version": "3.0.1-alpha.3",
"from": "vscode-languageclient@next",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-2.4.2-next.22.tgz"
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-3.0.1-alpha.3.tgz"
},
"vscode-languageserver-types": {
"version": "1.0.3",
"from": "vscode-languageserver-types@>=1.0.3 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.3.tgz"
"version": "3.0.1-alpha.2",
"from": "vscode-languageserver-types@>=3.0.1-alpha.2 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.1-alpha.2.tgz"
},
"vscode-nls": {
"version": "1.0.7",
+13 -10
View File
@@ -61,34 +61,34 @@
"properties": {
"json.schemas": {
"type": "array",
"description": "Associate schemas to JSON files in the current project",
"description": "%json.schemas.desc%",
"items": {
"type": "object",
"default": {
"fileMatch": [
"{{/myfile}}"
"/myfile"
],
"url": "{{schemaURL}}"
"url": "schemaURL"
},
"properties": {
"url": {
"type": "string",
"default": "/user.schema.json",
"description": "A URL to a schema or a relative path to a schema in the current directory"
"description": "%json.schemas.url.desc%"
},
"fileMatch": {
"type": "array",
"items": {
"type": "string",
"default": "MyFile.json",
"description": "A file pattern that can contain '*' to match against when resolving JSON files to schemas."
"description": "%json.schemas.fileMatch.item.desc%"
},
"minItems": 1,
"description": "An array of file patterns to match against when resolving JSON files to schemas."
"description": "%json.schemas.fileMatch.desc%"
},
"schema": {
"$ref": "http://json-schema.org/draft-04/schema#",
"description": "The schema definition for the given URL. The schema only needs to be provided to avoid accesses to the schema URL."
"description": "%json.schemas.schema.desc%"
}
}
}
@@ -96,14 +96,17 @@
"json.format.enable": {
"type": "boolean",
"default": true,
"description": "Enable/disable default JSON formatter (requires restart)"
"description": "%json.format.enable.desc%"
}
}
}
},
"dependencies": {
"vscode-extension-telemetry": "^0.0.5",
"vscode-languageclient": "^2.4.2-next.22",
"vscode-languageclient": "3.0.1-alpha.3",
"vscode-nls": "^1.0.7"
},
"devDependencies": {
"@types/node": "^6.0.51"
}
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"json.schemas.desc": "Associate schemas to JSON files in the current project",
"json.schemas.url.desc": "A URL to a schema or a relative path to a schema in the current directory",
"json.schemas.fileMatch.desc": "An array of file patterns to match against when resolving JSON files to schemas.",
"json.schemas.fileMatch.item.desc": "A file pattern that can contain '*' to match against when resolving JSON files to schemas.",
"json.schemas.schema.desc": "The schema definition for the given URL. The schema only needs to be provided to avoid accesses to the schema URL.",
"json.format.enable.desc": "Enable/disable default JSON formatter (requires restart)"
}
+10 -17
View File
@@ -43,31 +43,24 @@
"resolved": "https://registry.npmjs.org/request-light/-/request-light-0.1.0.tgz"
},
"vscode-json-languageservice": {
"version": "2.0.0-next.2",
"version": "2.0.0-next.5",
"from": "vscode-json-languageservice@next",
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-2.0.0-next.2.tgz",
"dependencies": {
"vscode-languageserver-types": {
"version": "1.0.4",
"from": "vscode-languageserver-types@>=1.0.4 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.4.tgz"
}
}
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-2.0.0-next.5.tgz"
},
"vscode-jsonrpc": {
"version": "2.3.2-next.5",
"from": "vscode-jsonrpc@>=2.3.2-next.2 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-2.3.2-next.5.tgz"
"version": "3.0.1-alpha.2",
"from": "vscode-jsonrpc@>=3.0.1-alpha.2 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.0.1-alpha.2.tgz"
},
"vscode-languageserver": {
"version": "2.4.0-next.12",
"version": "3.0.1-alpha.3",
"from": "vscode-languageserver@next",
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-2.4.0-next.12.tgz"
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.0.1-alpha.3.tgz"
},
"vscode-languageserver-types": {
"version": "1.0.3",
"from": "vscode-languageserver-types@>=1.0.3 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.3.tgz"
"version": "3.0.1-alpha.2",
"from": "vscode-languageserver-types@>=3.0.1-alpha.2 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.1-alpha.2.tgz"
},
"vscode-nls": {
"version": "1.0.7",
+6 -3
View File
@@ -9,9 +9,12 @@
},
"dependencies": {
"request-light": "^0.1.0",
"vscode-json-languageservice": "^2.0.0-next.2",
"vscode-languageserver": "^2.4.0-next.12",
"vscode-nls": "^1.0.4"
"vscode-json-languageservice": "^2.0.0-next.5",
"vscode-languageserver": "3.0.1-alpha.3",
"vscode-nls": "^1.0.7"
},
"devDependencies": {
"@types/node": "^6.0.51"
},
"scripts": {
"compile": "gulp compile-extension:json-server",
+2 -2
View File
@@ -29,11 +29,11 @@ interface ISchemaAssociations {
}
namespace SchemaAssociationNotification {
export const type: NotificationType<ISchemaAssociations> = { get method() { return 'json/schemaAssociations'; } };
export const type: NotificationType<ISchemaAssociations, any> = { get method() { return 'json/schemaAssociations'; }, _: null };
}
namespace VSCodeContentRequest {
export const type: RequestType<string, string, any> = { get method() { return 'vscode/content'; } };
export const type: RequestType<string, string, any, any> = { get method() { return 'vscode/content'; }, _: null };
}
// Create a connection for the server
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { MarkedString, CompletionItemKind, CompletionItem } from 'vscode-languageserver';
import { MarkedString, CompletionItemKind, CompletionItem, SnippetString } from 'vscode-languageserver';
import Strings = require('../utils/strings');
import { JSONWorkerContribution, JSONPath, CompletionsCollector } from 'vscode-json-languageservice';
@@ -12,8 +12,8 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
let globProperties: CompletionItem[] = [
{ kind: CompletionItemKind.Value, label: localize('assocLabelFile', "Files with Extension"), insertText: '"*.{{extension}}": "{{language}}"', documentation: localize('assocDescriptionFile', "Map all files matching the glob pattern in their filename to the language with the given identifier.") },
{ kind: CompletionItemKind.Value, label: localize('assocLabelPath', "Files with Path"), insertText: '"/{{path to file}}/*.{{extension}}": "{{language}}"', documentation: localize('assocDescriptionPath', "Map all files matching the absolute path glob pattern in their path to the language with the given identifier.") }
{ kind: CompletionItemKind.Value, label: localize('assocLabelFile', "Files with Extension"), insertText: SnippetString.create('"*.${1:extension}": "${2:language}"'), documentation: localize('assocDescriptionFile', "Map all files matching the glob pattern in their filename to the language with the given identifier.") },
{ kind: CompletionItemKind.Value, label: localize('assocLabelPath', "Files with Path"), insertText: SnippetString.create('"/${1:path to file}/*.${2:extension}": "${3:language}"'), documentation: localize('assocDescriptionPath', "Map all files matching the absolute path glob pattern in their path to the language with the given identifier.") }
];
export class FileAssociationContribution implements JSONWorkerContribution {
@@ -37,7 +37,6 @@ export class FileAssociationContribution implements JSONWorkerContribution {
public collectPropertyCompletions(resource: string, location: JSONPath, currentWord: string, addValue: boolean, isLast: boolean, result: CompletionsCollector): Thenable<any> {
if (this.isSettingsFile(resource) && location.length === 1 && location[0] === 'files.associations') {
globProperties.forEach(e => {
e.filterText = e.insertText;
result.add(e);
});
}
@@ -51,7 +50,7 @@ export class FileAssociationContribution implements JSONWorkerContribution {
result.add({
kind: CompletionItemKind.Value,
label: l,
insertText: JSON.stringify('{{' + l + '}}'),
insertText: SnippetString.create(JSON.stringify('${1:' + l + '}')),
filterText: JSON.stringify(l)
});
});
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { MarkedString, CompletionItemKind, CompletionItem } from 'vscode-languageserver';
import { MarkedString, CompletionItemKind, CompletionItem, SnippetString } from 'vscode-languageserver';
import Strings = require('../utils/strings');
import { JSONWorkerContribution, JSONPath, CompletionsCollector } from 'vscode-json-languageservice';
@@ -12,18 +12,18 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
let globProperties: CompletionItem[] = [
{ kind: CompletionItemKind.Value, label: localize('fileLabel', "Files by Extension"), insertText: '"**/*.{{extension}}": true', documentation: localize('fileDescription', "Match all files of a specific file extension.") },
{ kind: CompletionItemKind.Value, label: localize('fileLabel', "Files by Extension"), insertText: SnippetString.create('"**/*.${1:extension}": true'), documentation: localize('fileDescription', "Match all files of a specific file extension.") },
{ kind: CompletionItemKind.Value, label: localize('filesLabel', "Files with Multiple Extensions"), insertText: '"**/*.{ext1,ext2,ext3}": true', documentation: localize('filesDescription', "Match all files with any of the file extensions.") },
{ kind: CompletionItemKind.Value, label: localize('derivedLabel', "Files with Siblings by Name"), insertText: '"**/*.{{source-extension}}": { "when": "$(basename).{{target-extension}}" }', documentation: localize('derivedDescription', "Match files that have siblings with the same name but a different extension.") },
{ kind: CompletionItemKind.Value, label: localize('topFolderLabel', "Folder by Name (Top Level)"), insertText: '"{{name}}": true', documentation: localize('topFolderDescription', "Match a top level folder with a specific name.") },
{ kind: CompletionItemKind.Value, label: localize('derivedLabel', "Files with Siblings by Name"), insertText: SnippetString.create('"**/*.${1:source-extension}": { "when": "$(basename).${2:target-extension}" }'), documentation: localize('derivedDescription', "Match files that have siblings with the same name but a different extension.") },
{ kind: CompletionItemKind.Value, label: localize('topFolderLabel', "Folder by Name (Top Level)"), insertText: SnippetString.create('"${1:name}": true'), documentation: localize('topFolderDescription', "Match a top level folder with a specific name.") },
{ kind: CompletionItemKind.Value, label: localize('topFoldersLabel', "Folders with Multiple Names (Top Level)"), insertText: '"{folder1,folder2,folder3}": true', documentation: localize('topFoldersDescription', "Match multiple top level folders.") },
{ kind: CompletionItemKind.Value, label: localize('folderLabel', "Folder by Name (Any Location)"), insertText: '"**/{{name}}": true', documentation: localize('folderDescription', "Match a folder with a specific name in any location.") },
{ kind: CompletionItemKind.Value, label: localize('folderLabel', "Folder by Name (Any Location)"), insertText: SnippetString.create('"**/${1:name}": true'), documentation: localize('folderDescription', "Match a folder with a specific name in any location.") },
];
let globValues: CompletionItem[] = [
{ kind: CompletionItemKind.Value, label: localize('trueLabel', "true"), insertText: 'true', documentation: localize('trueDescription', "Enable the pattern.") },
{ kind: CompletionItemKind.Value, label: localize('falseLabel', "false"), insertText: 'false', documentation: localize('falseDescription', "Disable the pattern.") },
{ kind: CompletionItemKind.Value, label: localize('derivedLabel', "Files with Siblings by Name"), insertText: '{ "when": "$(basename).{{extension}}" }', documentation: localize('siblingsDescription', "Match files that have siblings with the same name but a different extension.") }
{ kind: CompletionItemKind.Value, label: localize('trueLabel', "true"), filterText: 'true', insertText: 'true', documentation: localize('trueDescription', "Enable the pattern.") },
{ kind: CompletionItemKind.Value, label: localize('falseLabel', "false"), filterText: 'false', insertText: 'false', documentation: localize('falseDescription', "Disable the pattern.") },
{ kind: CompletionItemKind.Value, label: localize('derivedLabel', "Files with Siblings by Name"), insertText: SnippetString.create('{ "when": "$(basename).${1:extension}" }'), documentation: localize('siblingsDescription', "Match files that have siblings with the same name but a different extension.") }
];
export class GlobPatternContribution implements JSONWorkerContribution {
@@ -42,7 +42,6 @@ export class GlobPatternContribution implements JSONWorkerContribution {
public collectPropertyCompletions(resource: string, location: JSONPath, currentWord: string, addValue: boolean, isLast: boolean, result: CompletionsCollector): Thenable<any> {
if (this.isSettingsFile(resource) && location.length === 1 && ((location[0] === 'files.exclude') || (location[0] === 'search.exclude'))) {
globProperties.forEach(e => {
e.filterText = e.insertText;
result.add(e);
});
}
@@ -53,7 +52,6 @@ export class GlobPatternContribution implements JSONWorkerContribution {
public collectValueCompletions(resource: string, location: JSONPath, currentKey: string, result: CompletionsCollector): Thenable<any> {
if (this.isSettingsFile(resource) && location.length === 1 && ((location[0] === 'files.exclude') || (location[0] === 'search.exclude'))) {
globValues.forEach(e => {
e.filterText = e.insertText;
result.add(e);
});
}
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { MarkedString, CompletionItemKind, CompletionItem } from 'vscode-languageserver';
import { MarkedString, CompletionItemKind, CompletionItem, SnippetString } from 'vscode-languageserver';
import Strings = require('../utils/strings');
import { XHRResponse, getErrorStatusDescription, xhr } from 'request-light';
import { JSONWorkerContribution, JSONPath, CompletionsCollector } from 'vscode-json-languageservice';
@@ -47,9 +47,10 @@ export class ProjectJSONContribution implements JSONWorkerContribution {
this.cacheSize--;
return false;
}
let insertTextValue = (<SnippetString>item.insertText).value;
item.detail = entry.version;
item.documentation = entry.description;
item.insertText = item.insertText.replace(/\{\{\}\}/, '{{' + entry.version + '}}');
item.insertText = insertTextValue.replace(/\$1/, '${1:' + entry.version + '}');
return true;
}
return false;
@@ -102,15 +103,15 @@ export class ProjectJSONContribution implements JSONWorkerContribution {
public collectDefaultCompletions(resource: string, result: CompletionsCollector): Thenable<any> {
if (this.isProjectJSONFile(resource)) {
let defaultValue = {
'version': '{{1.0.0-*}}',
let insertText = SnippetString.create(JSON.stringify({
'version': '${1:1.0.0-*}',
'dependencies': {},
'frameworks': {
'net461': {},
'netcoreapp1.0': {}
}
};
result.add({ kind: CompletionItemKind.Class, label: localize('json.project.default', 'Default project.json'), insertText: JSON.stringify(defaultValue, null, '\t'), documentation: '' });
}, null, '\t'));
result.add({ kind: CompletionItemKind.Class, label: localize('json.project.default', 'Default project.json'), insertText, documentation: '' });
}
return null;
}
@@ -149,12 +150,12 @@ export class ProjectJSONContribution implements JSONWorkerContribution {
let name = results[i];
let insertText = JSON.stringify(name);
if (addValue) {
insertText += ': "{{}}"';
insertText += ': "$1"';
if (!isLast) {
insertText += ',';
}
}
let item: CompletionItem = { kind: CompletionItemKind.Property, label: name, insertText: insertText, filterText: JSON.stringify(name) };
let item: CompletionItem = { kind: CompletionItemKind.Property, label: name, insertText: SnippetString.create(insertText), filterText: JSON.stringify(name) };
if (!this.completeWithCache(name, item)) {
item.data = RESOLVE_ID + name;
}
-112
View File
@@ -1,112 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/**
* The Thenable (E.g. PromiseLike) and Promise declarions are taken from TypeScript's
* lib.core.es6.d.ts file. See above Copyright notice.
*/
/**
* Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
* and others. This API makes no assumption about what promise libary is being used which
* enables reusing existing code without migrating to a specific promise implementation. Still,
* we recommand the use of native promises which are available in VS Code.
*/
interface Thenable<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
}
/**
* Represents the completion of an asynchronous operation
*/
interface Promise<T> extends Thenable<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Promise<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
/**
* Attaches a callback for only the rejection of the Promise.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of the callback.
*/
catch(onrejected?: (reason: any) => T | Thenable<T>): Promise<T>;
}
interface PromiseConstructor {
/**
* Creates a new Promise.
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
new <T>(executor: (resolve: (value?: T | Thenable<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T>(values: Array<T | Thenable<T>>): Promise<T[]>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T>(values: Array<T | Thenable<T>>): Promise<T>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject(reason: any): Promise<void>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject<T>(reason: any): Promise<T>;
/**
* Creates a new resolved promise for the provided value.
* @param value A promise.
* @returns A promise whose internal state matches the provided promise.
*/
resolve<T>(value: T | Thenable<T>): Promise<T>;
/**
* Creates a new resolved promise .
* @returns A resolved promise.
*/
resolve(): Promise<void>;
}
declare var Promise: PromiseConstructor;
+4 -2
View File
@@ -1,11 +1,13 @@
{
"compilerOptions": {
"noLib": true,
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"sourceRoot": "../src",
"outDir": "./out"
"outDir": "./out",
"lib": [
"es5", "es2015.promise"
]
},
"exclude": [
"node_modules"
+4
View File
@@ -10,6 +10,10 @@ body {
line-height: 22px;
}
body.scrollBeyondLastLine {
margin-bottom: calc(100vh - 22px);
}
img {
max-width: 100%;
max-height: 100%;
+14 -9
View File
@@ -45,7 +45,7 @@
{
"command": "markdown.showPreview",
"title": "%markdown.preview.title%",
"category": "%markdown.category%",
"category": "Markdown",
"icon": {
"light": "./media/Preview.svg",
"dark": "./media/Preview_inverse.svg"
@@ -54,7 +54,7 @@
{
"command": "markdown.showPreviewToSide",
"title": "%markdown.previewSide.title%",
"category": "%markdown.category%",
"category": "Markdown",
"icon": {
"light": "./media/PreviewOnRightPane_16x.svg",
"dark": "./media/PreviewOnRightPane_16x_dark.svg"
@@ -63,7 +63,7 @@
{
"command": "markdown.showSource",
"title": "%markdown.showSource.title%",
"category": "%markdown.category%",
"category": "Markdown",
"icon": {
"light": "./media/ViewSource.svg",
"dark": "./media/ViewSource_inverse.svg"
@@ -97,12 +97,13 @@
"command": "markdown.showPreview",
"key": "shift+ctrl+v",
"mac": "shift+cmd+v",
"when": "!terminalFocus"
"when": "editorFocus"
},
{
"command": "markdown.showPreviewToSide",
"key": "ctrl+k v",
"mac": "cmd+k v"
"mac": "cmd+k v",
"when": "editorFocus"
}
],
"snippets": [
@@ -117,14 +118,18 @@
"order": 20,
"properties": {
"markdown.styles": {
"type": ["array"],
"type": "array",
"default": [],
"description": "A list of URLs or local paths to CSS style sheets to use from the markdown preview. Relative paths are interpreted relative to the folder open in the explorer. If there is no open folder, they are interpreted relative to the location of the markdown file. All '\\' need to be written as '\\\\'."
"description": "%markdown.styles.dec%"
},
"markdown.previewFrontMatter": {
"type": ["string"],
"type": "string",
"enum": [
"hide",
"show"
],
"default": "hide",
"description": "Sets how YAML front matter should be rendered in the markdown preview. 'hide' removes the front matter. Otherwise, the front matter is treated as markdown content"
"description": "%markdown.previewFrontMatter.dec%"
}
}
}
+3 -2
View File
@@ -1,6 +1,7 @@
{
"markdown.category" : "Markdown",
"markdown.preview.title" : "Open Preview",
"markdown.previewSide.title" : "Open Preview to the Side",
"markdown.showSource.title" : "Show Source"
"markdown.showSource.title" : "Show Source",
"markdown.styles.dec": "A list of URLs or local paths to CSS style sheets to use from the markdown preview. Relative paths are interpreted relative to the folder open in the explorer. If there is no open folder, they are interpreted relative to the location of the markdown file. All '\\' need to be written as '\\\\'.",
"markdown.previewFrontMatter.dec": "Sets how YAML front matter should be rendered in the markdown preview. 'hide' removes the front matter. Otherwise, the front matter is treated as markdown content"
}
+2 -1
View File
@@ -225,6 +225,7 @@ class MDDocumentContentProvider implements vscode.TextDocumentContentProvider {
public provideTextDocumentContent(uri: vscode.Uri): Thenable<string> {
return vscode.workspace.openTextDocument(vscode.Uri.parse(uri.query)).then(document => {
const scrollBeyondLastLine = vscode.workspace.getConfiguration('editor')['scrollBeyondLastLine'];
const head = [].concat(
'<!DOCTYPE html>',
'<html>',
@@ -235,7 +236,7 @@ class MDDocumentContentProvider implements vscode.TextDocumentContentProvider {
this.computeCustomStyleSheetIncludes(uri),
`<base href="${document.uri.toString(true)}">`,
'</head>',
'<body>'
`<body class="${scrollBeyondLastLine ? 'scrollBeyondLastLine' : ''}">`
).join('\n');
const body = this._renderer.render(this.getDocumentContentForPreview(document));
@@ -550,7 +550,7 @@
<key>fenced_code_block_css</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(css|css.erb)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(css|css.erb)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -566,7 +566,7 @@
<key>fenced_code_block_basic</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(html|htm|shtml|xhtml|inc|tmpl|tpl)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(html|htm|shtml|xhtml|inc|tmpl|tpl)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -582,7 +582,7 @@
<key>fenced_code_block_ini</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(ini|conf)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(ini|conf)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -598,7 +598,7 @@
<key>fenced_code_block_java</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(java|bsh)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(java|bsh)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -614,7 +614,7 @@
<key>fenced_code_block_lua</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(lua)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(lua)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -630,7 +630,7 @@
<key>fenced_code_block_makefile</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(Makefile|makefile|GNUmakefile|OCamlMakefile)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(Makefile|makefile|GNUmakefile|OCamlMakefile)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -646,7 +646,7 @@
<key>fenced_code_block_perl</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(perl|pl|pm|pod|t|PL|psgi|vcl)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(perl|pl|pm|pod|t|PL|psgi|vcl)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -662,7 +662,7 @@
<key>fenced_code_block_r</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(R|r|s|S|Rprofile)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(R|r|s|S|Rprofile)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -678,7 +678,7 @@
<key>fenced_code_block_ruby</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(ruby|rb|rbx|rjs|Rakefile|rake|cgi|fcgi|gemspec|irbrc|Capfile|ru|prawn|Cheffile|Gemfile|Guardfile|Hobofile|Vagrantfile|Appraisals|Rantfile|Berksfile|Berksfile.lock|Thorfile|Puppetfile)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(ruby|rb|rbx|rjs|Rakefile|rake|cgi|fcgi|gemspec|irbrc|Capfile|ru|prawn|Cheffile|Gemfile|Guardfile|Hobofile|Vagrantfile|Appraisals|Rantfile|Berksfile|Berksfile.lock|Thorfile|Puppetfile)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -694,7 +694,7 @@
<key>fenced_code_block_php</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(php|php3|php4|php5|phpt|phtml|aw|ctp)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(php|php3|php4|php5|phpt|phtml|aw|ctp)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -710,7 +710,7 @@
<key>fenced_code_block_sql</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(sql|ddl|dml)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(sql|ddl|dml)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -726,7 +726,7 @@
<key>fenced_code_block_vs_net</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(vb)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(vb)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -742,7 +742,7 @@
<key>fenced_code_block_xml</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(xml|xsd|tld|jsp|pt|cpt|dtml|rss|opml)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(xml|xsd|tld|jsp|pt|cpt|dtml|rss|opml)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -758,7 +758,7 @@
<key>fenced_code_block_xsl</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(xsl|xslt)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(xsl|xslt)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -774,7 +774,7 @@
<key>fenced_code_block_yaml</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(yaml|yml)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(yaml|yml)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -790,7 +790,7 @@
<key>fenced_code_block_dosbatch</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(bat|batch)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(bat|batch)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -806,7 +806,7 @@
<key>fenced_code_block_clojure</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(clj|cljs|clojure)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(clj|cljs|clojure)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -822,7 +822,7 @@
<key>fenced_code_block_coffee</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(coffee|Cakefile|coffee.erb)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(coffee|Cakefile|coffee.erb)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -838,7 +838,7 @@
<key>fenced_code_block_c</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(c|h)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(c|h)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -854,7 +854,7 @@
<key>fenced_code_block_diff</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(patch|diff|rej)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(patch|diff|rej)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -870,7 +870,7 @@
<key>fenced_code_block_dockerfile</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(dockerfile|Dockerfile)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(dockerfile|Dockerfile)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -886,7 +886,7 @@
<key>fenced_code_block_git_commit</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(COMMIT_EDITMSG|MERGE_MSG)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(COMMIT_EDITMSG|MERGE_MSG)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -902,7 +902,7 @@
<key>fenced_code_block_git_rebase</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(git-rebase-todo)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(git-rebase-todo)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -918,7 +918,7 @@
<key>fenced_code_block_groovy</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(groovy|gvy)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(groovy|gvy)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -934,7 +934,7 @@
<key>fenced_code_block_jade</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(jade)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(jade)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -950,7 +950,7 @@
<key>fenced_code_block_js</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(js|jsx|javascript)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(js|jsx|javascript)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -966,7 +966,7 @@
<key>fenced_code_block_js_regexp</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(regexp)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(regexp)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -982,7 +982,7 @@
<key>fenced_code_block_json</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(json|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(json|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -998,7 +998,7 @@
<key>fenced_code_block_less</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(less)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(less)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -1014,7 +1014,7 @@
<key>fenced_code_block_objc</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(objectivec|mm|objc|obj-c|m|h)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(objectivec|mm|objc|obj-c|m|h)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -1030,7 +1030,7 @@
<key>fenced_code_block_perl6</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(perl6|p6|pl6|pm6|nqp)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(perl6|p6|pl6|pm6|nqp)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -1046,7 +1046,7 @@
<key>fenced_code_block_powershell</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(powershell|ps1|psm1|psd1)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(powershell|ps1|psm1|psd1)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -1062,7 +1062,7 @@
<key>fenced_code_block_python</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -1078,7 +1078,7 @@
<key>fenced_code_block_regexp_python</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(re)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(re)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -1094,7 +1094,7 @@
<key>fenced_code_block_shell</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -1110,7 +1110,7 @@
<key>fenced_code_block_ts</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(typescript|ts)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(typescript|ts)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -1126,7 +1126,7 @@
<key>fenced_code_block_tsx</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(tsx)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(tsx)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -1142,7 +1142,7 @@
<key>fenced_code_block_csharp</key>
<dict>
<key>begin</key>
<string>(^|\G)\s*(([`~]){3,})\s*(cs|csharp|c#)\s*$</string>
<string>(^|\G)\s*(([`~]){3,})\s*(cs|csharp|c#)(\s+.*)?$</string>
<key>name</key>
<string>markup.fenced_code.block.markdown</string>
<key>while</key>
@@ -31,7 +31,7 @@
{
"name": "debug",
"repositoryURL": "https://github.com/visionmedia/debug",
"version": "2.2.0",
"version": "2.3.3",
"license": "MIT",
"isProd": true
},
@@ -52,7 +52,7 @@
{
"name": "glob",
"repositoryURL": "https://github.com/isaacs/node-glob",
"version": "7.0.6",
"version": "7.1.1",
"license": "ISC",
"isProd": true
},
@@ -73,7 +73,7 @@
{
"name": "inflight",
"repositoryURL": "https://github.com/npm/inflight",
"version": "1.0.5",
"version": "1.0.6",
"license": "ISC",
"isProd": true
},
@@ -94,7 +94,7 @@
{
"name": "ms",
"repositoryURL": "https://github.com/rauchg/ms.js",
"version": "0.7.1",
"version": "0.7.2",
"license": "MIT",
"isProd": true
},
@@ -108,7 +108,7 @@
{
"name": "path-is-absolute",
"repositoryURL": "https://github.com/sindresorhus/path-is-absolute",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",
"isProd": true
},
+11
View File
@@ -0,0 +1,11 @@
{
"name": "vscode-extensions",
"version": "0.0.1",
"dependencies": {
"typescript": {
"version": "2.0.10",
"from": "typescript@>=2.0.10 <3.0.0",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.0.10.tgz"
}
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"name": "vscode-extensions",
"version": "0.0.1",
"private": true,
"description": "Dependencies shared by all extensions",
"dependencies": {
"typescript": "^2.0.10"
},
"scripts": {
"postinstall": "node ./postinstall"
}
}
+34
View File
@@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
const fs = require('fs');
const path = require('path');
function removeFile(filePath) {
try {
fs.unlinkSync(filePath);
console.log(`removed '${filePath}'`);
} catch (e) {
console.warn(e);
}
}
// delete unused typescript stuff in lib folder
const libPath = path.dirname(require.resolve('typescript'));
for (let name of fs.readdirSync(libPath)) {
if (name !== 'typescript.d.ts' && name !== 'typescript.js' && name !== 'lib.es6.d.ts') {
removeFile(path.join(libPath, name));
}
}
// delete unused typescript stuff in bin folder
const binPath = path.join(path.dirname(libPath), 'bin');
for (let name of fs.readdirSync(binPath)) {
removeFile(path.join(binPath, name));
}
removeFile(path.join(path.dirname(libPath), 'Gulpfile.ts'));
@@ -464,6 +464,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
allowSyntheticDefaultImports: true,
allowNonTsExtensions: true,
allowJs: true,
jsx: 'Preserve'
};
let args: Proto.SetCompilerOptionsForInferredProjectsArgs = {
options: compilerOptions
@@ -8,7 +8,7 @@
import * as vscode from 'vscode';
import { ITypescriptServiceClient } from '../typescriptService';
import { loadMessageBundle } from 'vscode-nls';
import { dirname } from 'path';
import { dirname, join } from 'path';
const localize = loadMessageBundle();
const selector = ['javascript', 'javascriptreact'];
@@ -77,7 +77,6 @@ export function create(client: ITypescriptServiceClient, isOpen: (path: string)
}
if (fileNames.length > fileLimit) {
let largeRoots = computeLargeRoots(configFileName, fileNames).map(f => `'/${f}/'`).join(', ');
currentHint = {
@@ -91,7 +90,14 @@ export function create(client: ITypescriptServiceClient, isOpen: (path: string)
projectHinted[configFileName] = true;
item.hide();
return vscode.workspace.openTextDocument(configFileName)
let configFileUri: vscode.Uri;
if (dirname(configFileName).indexOf(vscode.workspace.rootPath) === 0) {
configFileUri = vscode.Uri.file(configFileName);
} else {
configFileUri = vscode.Uri.parse('untitled://' + join(vscode.workspace.rootPath, 'jsconfig.json'));
}
return vscode.workspace.openTextDocument(configFileUri)
.then(vscode.window.showTextDocument);
}
}]
+2 -2
View File
@@ -62,7 +62,7 @@ export function cleanUp(): Thenable<any> {
}
});
vscode.commands.executeCommand('workbench.action.closeAllEditors').then(null, reject);
vscode.commands.executeCommand('workbench.action.closeAllEditors').then(undefined, reject);
}).then(() => {
assert.equal(vscode.window.visibleTextEditors.length, 0);
@@ -76,4 +76,4 @@ export function cleanUp(): Thenable<any> {
// assert.equal(vscode.workspace.textDocuments.length, 0);
});
}
}
@@ -19,7 +19,7 @@ suite('window namespace tests', () => {
return window.showTextDocument(doc).then((editor) => {
const active = window.activeTextEditor;
assert.ok(active);
assert.ok(pathEquals(active.document.uri.fsPath, doc.uri.fsPath));
assert.ok(pathEquals(active!.document.uri.fsPath, doc.uri.fsPath));
});
});
});
@@ -6,7 +6,7 @@
'use strict';
import * as assert from 'assert';
import { workspace, TextDocument, window, Position, Uri, EventEmitter, WorkspaceEdit } from 'vscode';
import { workspace, TextDocument, window, Position, Uri, EventEmitter, WorkspaceEdit, Disposable } from 'vscode';
import { createRandomFile, deleteFile, cleanUp, pathEquals } from './utils';
import { join, basename } from 'path';
import * as fs from 'fs';
@@ -48,11 +48,13 @@ suite('workspace-namespace', () => {
test('textDocuments', () => {
assert.ok(Array.isArray(workspace.textDocuments));
assert.throws(() => workspace.textDocuments = null);
assert.throws(() => (<any>workspace).textDocuments = null);
});
test('rootPath', () => {
assert.ok(pathEquals(workspace.rootPath, join(__dirname, '../testWorkspace')));
if (workspace.rootPath) {
assert.ok(pathEquals(workspace.rootPath, join(__dirname, '../testWorkspace')));
}
assert.throws(() => workspace.rootPath = 'farboo');
});
@@ -64,23 +66,22 @@ suite('workspace-namespace', () => {
});
});
test('openTextDocument, illegal path', done => {
workspace.openTextDocument('funkydonky.txt').then(doc => {
done(new Error('missing error'));
test('openTextDocument, illegal path', () => {
return workspace.openTextDocument('funkydonky.txt').then(doc => {
throw new Error('missing error');
}, err => {
done();
// good!
});
});
test('openTextDocument, untitled is dirty', function (done) {
test('openTextDocument, untitled is dirty', function () {
if (process.platform === 'win32') {
return done(); // TODO@Joh this test fails on windows
return; // TODO@Joh this test fails on windows
}
workspace.openTextDocument(Uri.parse('untitled:' + join(workspace.rootPath, './newfile.txt'))).then(doc => {
return workspace.openTextDocument(Uri.parse('untitled:' + join(workspace.rootPath, './newfile.txt'))).then(doc => {
assert.equal(doc.uri.scheme, 'untitled');
assert.ok(doc.isDirty);
done();
});
});
@@ -137,7 +138,7 @@ suite('workspace-namespace', () => {
test('events: onDidOpenTextDocument, onDidChangeTextDocument, onDidSaveTextDocument', () => {
return createRandomFile().then(file => {
let disposables = [];
let disposables: Disposable[] = [];
let onDidOpenTextDocument = false;
disposables.push(workspace.onDidOpenTextDocument(e => {
@@ -370,7 +371,7 @@ suite('workspace-namespace', () => {
});
test('findFiles', () => {
return workspace.findFiles('*.js', null).then((res) => {
return workspace.findFiles('*.js').then((res) => {
assert.equal(res.length, 1);
assert.equal(basename(workspace.asRelativePath(res[0])), 'far.js');
});
+3 -2
View File
@@ -4,9 +4,10 @@
"target": "ES5",
"outDir": "out",
"noLib": true,
"sourceMap": true
"sourceMap": true,
"strictNullChecks": true
},
"exclude": [
"node_modules"
]
}
}
+2 -1
View File
@@ -6,7 +6,8 @@
declare function run(): void;
declare function suite(name: string, fn: (err?) => void);
declare function test(name: string, fn: (done?: (err?) => void) => void);
declare function test(name: string, fn: () => void);
declare function test(name: string, fn: (done: (err?) => void) => void);
declare function suiteSetup(fn: (done?: (err?) => void) => void);
declare function suiteTeardown(fn: (done?: (err?) => void) => void);
declare function setup(fn: (done?: (err?) => void) => void);
@@ -27,7 +27,7 @@
"typescript.tsdk.desc": "指定包含要使用的 tsserver 和 lib*.d.ts 文件的文件夹路径。",
"typescript.tsdk_version.desc": "指定 tsserver 的版本。仅在未使用 npm 安装 tsserver 时需要。",
"typescript.tsserver.experimentalAutoBuild": "启用实验性自动生成。要求安装 1.9 dev 或 2.x tsserver 版本并在更改后重启 VS Code。",
"typescript.tsserver.trace": "启用跟踪发送到 TS 服务器的消息。",
"typescript.tsserver.trace": "发送到 TS 服务器的消息启用跟踪。",
"typescript.useCodeSnippetsOnMethodSuggest.dec": "完成函数的参数签名。",
"typescript.validate.enable": "启用/禁用 TypeScript 验证。"
}
@@ -97,6 +97,7 @@
"miToggleDebugConsole": "调试控制台(&&B)",
"miToggleDevTools": "切换开发人员工具(&&T)",
"miToggleEditorLayout": "切换编辑器组布局(&&L)",
"miToggleFocusMode": "切换焦点模式",
"miToggleFullScreen": "切换全屏(&&F)",
"miToggleIntegratedTerminal": "集成终端(&&I)",
"miToggleMenuBar": "切换菜单栏(&&B)",
@@ -9,7 +9,7 @@
"outroMsg": "可以通过按 Esc 消除此工具提示并返回到编辑器。",
"status": "状态:",
"tabFocusModeOffMsg": "在当前编辑器中按 Tab 将插入制表符。通过按 {0} 切换此行为。",
"tabFocusModeOffMsgNoKb": "在当前编辑器中按 Tab 会将焦点移动到下一个可聚焦的元素。当前无法通过键绑定触发命令 {0}。",
"tabFocusModeOffMsgNoKb": "在当前编辑器中按 Tab 会插入制表符。当前无法通过键绑定触发命令 {0}。",
"tabFocusModeOnMsg": "在当前编辑器中按 Tab 会将焦点移动到下一个可聚焦的元素。通过按 {0} 切换此行为。",
"tabFocusModeOnMsgNoKb": "在当前编辑器中按 Tab 会将焦点移动到下一个可聚焦的元素。当前无法通过键绑定触发命令 {0}。"
}
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
// Do not edit this file. It is machine generated.
{
"invalid.embeddedLanguages": "\"contributes.{0}.embeddedLanguages\" 中值无效。必须为从作用域名称到语言的对象映射。给定值: {1}",
"invalid.embeddedLanguages": "\"contributes.{0}.embeddedLanguages\" 中值无效。必须为从作用域名称到语言的对象映射。提供的值: {1}",
"invalid.injectTo": "\"contributes.{0}.injectTo\" 中的值无效。必须为语言范围名称数组。提供的值: {1}",
"invalid.language": "“contributes.{0}.language”中存在未知的语言。提供的值: {1}",
"invalid.path.0": "“contributes.{0}.path”中应为字符串。提供的值: {1}",
@@ -7,5 +7,5 @@
"activationError": "激活扩展“{0}”失败: {1}。",
"failedDep1": "无法激活扩展”{1}“。原因: 无法激活依赖关系”{0}“。",
"failedDep2": "无法激活扩展”{0}“。原因: 依赖关系多于 10 级(最可能是依赖关系循环)。",
"unknownDep": "无法激活扩展”{1}“。原因未知依赖关系{0}。"
"unknownDep": "无法激活扩展”{1}“。原因: 未知依赖关系{0}。"
}
@@ -34,9 +34,10 @@
"navigateNext": "前进",
"navigatePrevious": "后退",
"openNextEditor": "打开下一个编辑器",
"openNextEditorInGroup": "打开组中下一个最近使用的编辑器",
"openNextRecentlyUsedEditorInGroup": "打开组中下一个最近使用的编辑器",
"openPreviousEditor": "打开上一个编辑器",
"openPreviousEditorInGroup": "打开组中上一个最近使用的编辑器",
"openPreviousRecentlyUsedEditorInGroup": "打开组中上一个最近使用的编辑器",
"openToSide": "打开到侧边",
"reopenClosedEditor": "重新打开已关闭的编辑器",
"showAllEditors": "显示所有编辑器",
@@ -32,7 +32,7 @@
"pickEncodingForSave": "选择用于保存的文件编码",
"pickEndOfLine": "选择行尾序列",
"pickLanguage": "选择语言模式",
"pickLanguageToConfigure": "选择语言模式与“{0}”关联",
"pickLanguageToConfigure": "选择与“{0}”关联的语言模式",
"reopenWithEncoding": "通过编码重新打开",
"saveWithEncoding": "通过编码保存",
"selectEOL": "选择行尾序列",
@@ -4,5 +4,6 @@
*--------------------------------------------------------------------------------------------*/
// Do not edit this file. It is machine generated.
{
"telemetry.enableCrashReporting": "启用要发送给 Microsoft 的故障报表。\n\t// 此选项需重启才可生效。"
"telemetry.enableCrashReporting": "启用要发送给 Microsoft 的故障报表。\n\t// 此选项需重启才可生效。",
"telemetryConfigurationTitle": "遥测"
}
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
// Do not edit this file. It is machine generated.
{
"notAvailable": "不可用",
"snapshotObj": "仅显示了此对象的基元值。",
"startDebugFirst": "请启动调试会话以评估",
"unknownSource": "未知源",
@@ -5,7 +5,7 @@
// Do not edit this file. It is machine generated.
{
"emmetConfigurationTitle": "Emmet",
"emmetExclude": "其中 emmet 缩写不应展开的语言数组。",
"emmetExclude": "emmet 缩写不应在其中展开的语言数组。",
"emmetPreferences": "用于修改 Emmet 的某些操作和解决程序的首选项。",
"emmetSyntaxProfiles": "为指定的语法定义配置文件或使用带有特定规则的配置文件。",
"triggerExpansionOnTab": "启用后,按 TAB 键时,将展开 Emmet 缩写。"
@@ -5,17 +5,22 @@
// Do not edit this file. It is machine generated.
{
"ConfigureWorkspaceRecommendations.noWorkspace": "建议仅在工作区文件夹上可用。",
"ManageExtensionAction.uninstallingTooltip": "正在卸载",
"OpenExtensionsFile.failed": "无法在 \".vscode\" 文件夹({0})内创建 \"extensions.json\" 文件。",
"Uninstalling": "正在卸载",
"builtin": "内置",
"clearExtensionsInput": "清除扩展输入",
"configureWorkspaceRecommendedExtensions": "配置建议的扩展(工作区)",
"disableAction": "禁用",
"disableAll": "禁用所有已安装的扩展",
"disableAllWorkspace": "禁用此工作区的所有已安装的扩展",
"disableAlwaysAction.label": "禁用",
"disableForWorkspaceAction": "工作区",
"disableForWorkspaceAction.label": "禁用(工作区)",
"disableGloballyAction": "始终",
"enableAction": "启用",
"enableAll": "禁用所有已安装的扩展",
"enableAllWorkspace": "启用此工作区的所有已安装的扩展",
"enableAlwaysAction.label": "启用",
"enableForWorkspaceAction": "工作区",
"enableForWorkspaceAction.label": "启用(工作区)",
@@ -23,7 +28,14 @@
"installAction": "安装",
"installExtensions": "安装扩展",
"installing": "正在安装",
"postDisableMessage": "重载此窗口以停用扩展“{0}”?",
"postDisableTooltip": "重载以停用",
"postEnableMessage": "重载此窗口以激活扩展“{0}”?",
"postEnableTooltip": "重载以激活",
"postUninstallMessage": "重载此窗口以停用未安装的扩展“{0}”?",
"postUninstallTooltip": "重新加载以停用",
"postUpdateMessage": "重载此窗口以激活更新的扩展“{0}”?",
"postUpdateTooltip": "重载以更新",
"reloadAction": "重新加载",
"showDisabledExtensions": "显示已禁用的扩展",
"showInstalledExtensions": "显示已安装扩展",
@@ -14,7 +14,7 @@
"label.sendASmile": "通过 Tweet 向我们发送反馈。",
"other ways to contact us": "联系我们的其他方式",
"patchedVersion1": "安装已损坏。",
"patchedVersion2": "如果 提交了 bug,请指定此项。",
"patchedVersion2": "如果提交了 bug,请指定此项。",
"request a missing feature": "请求缺失功能",
"sendFeedback": "Tweet 反馈",
"sentiment": "您的体验如何?",
@@ -10,6 +10,7 @@
"autoSaveDelay": "控制延迟(以秒为单位),在该延迟后将自动保存更新后的文件。仅在 \"files.autoSave\" 设置为“{0}”时适用。",
"binaryFileEditor": "二进制文件编辑器",
"dynamicHeight": "控制打开的编辑器部分的高度是否应动态适应元素数量。",
"editorConfigurationTitle": "编辑器",
"enableDragAndDrop": "控制资源管理器是否应该允许通过拖放移动文件和文件夹。",
"encoding": "读取和编写文件时将使用的默认字符集编码。",
"eol": "默认行尾字符。",
@@ -23,7 +23,6 @@
"confirmUndoMessage": "是否确定要清理所有更改?",
"dirtyTreeCheckout": "无法签出。请首先提交你的工作或进行分段。",
"dirtyTreePull": "无法请求。请首先提交你的工作或进行分段。",
"do you want to continue": "是否确定要继续?",
"init": "初始化",
"irreversible": "此操作不可逆!",
"never again": "好,永不再显示",
@@ -37,7 +36,7 @@
"refresh": "刷新",
"stageAllChanges": "全部暂存",
"stageChanges": "暂存",
"sync is unpredictable": "此操作会在“{0}”来回推送和拉取提交。",
"sync is unpredictable": "此操作“{0}”推送和拉取提交。",
"undoAllChanges": "全部清理",
"undoChanges": "清理",
"undoLastCommit": "撤消上次提交",
@@ -3,4 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Do not edit this file. It is machine generated.
{}
{
"already exists": "目标存储库已存在,请选择要克隆到的另一个目录。",
"cloning": "正在克隆存储库“{0}”...",
"directory": "目标克隆目录",
"repo": "请提供一个 git 存储库 URL。",
"url": "存储库 URL"
}
@@ -4,5 +4,5 @@
*--------------------------------------------------------------------------------------------*/
// Do not edit this file. It is machine generated.
{
"devtools.webview": "开发人员Webview 工具"
"devtools.webview": "开发人员: Webview 工具"
}

Some files were not shown because too many files have changed in this diff Show More