Merge branch 'master' into octref/html-path-completion

This commit is contained in:
Martin Aeschlimann 2018-02-26 20:53:52 +01:00
commit 13dfd2dbf4
2110 changed files with 18393 additions and 4674 deletions

View file

@ -1,7 +1,7 @@
[
{
"name": "ms-vscode.node-debug",
"version": "1.21.2",
"version": "1.21.4",
"repo": "https://github.com/Microsoft/vscode-node-debug"
},
{

View file

@ -102,7 +102,7 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed
.pipe(es.through(function (data) {
var json = JSON.parse(data.contents.toString());
json.private = false;
data.contents = new Buffer(JSON.stringify(json, null, ' '));
data.contents = Buffer.from(JSON.stringify(json, null, ' '));
this.emit('data', data);
}))
.pipe(gulp.dest('out-monaco-editor-core')),
@ -142,7 +142,7 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed
var newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/');
strContents = strContents.replace(/\/\/\# sourceMappingURL=[^ ]+$/, newStr);
data.contents = new Buffer(strContents);
data.contents = Buffer.from(strContents);
this.emit('data', data);
})).pipe(gulp.dest('out-monaco-editor-core/min')),

View file

@ -36,7 +36,7 @@ const i18n = require('./lib/i18n');
const glob = require('glob');
const deps = require('./dependencies');
const getElectronVersion = require('./lib/electron').getElectronVersion;
// const createAsar = require('./lib/asar').createAsar;
const createAsar = require('./lib/asar').createAsar;
const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname));
//@ts-ignore review
@ -148,7 +148,7 @@ const config = {
name: product.nameLong,
urlSchemes: [product.urlProtocol]
}],
darwinCredits: darwinCreditsTemplate ? new Buffer(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : void 0,
darwinCredits: darwinCreditsTemplate ? Buffer.from(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : void 0,
linuxExecutableName: product.applicationName,
winIcon: 'resources/win32/code.ico',
token: process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'] || void 0,
@ -311,8 +311,8 @@ function packageTask(platform, arch, opts) {
.pipe(util.cleanNodeModule('keytar', ['binding.gyp', 'build/**', 'src/**', 'script/**', 'node_modules/**'], ['**/*.node']))
.pipe(util.cleanNodeModule('node-pty', ['binding.gyp', 'build/**', 'src/**', 'tools/**'], ['build/Release/*.exe', 'build/Release/*.dll', 'build/Release/*.node']))
.pipe(util.cleanNodeModule('nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a']))
.pipe(util.cleanNodeModule('vsda', ['binding.gyp', 'README.md', 'build/**', '*.bat', '*.sh', '*.cpp', '*.h'], ['build/Release/vsda.node']));
// .pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*'], 'app/node_modules.asar'));
.pipe(util.cleanNodeModule('vsda', ['binding.gyp', 'README.md', 'build/**', '*.bat', '*.sh', '*.cpp', '*.h'], ['build/Release/vsda.node']))
.pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*'], 'app/node_modules.asar'));
let all = es.merge(
packageJsonStream,

View file

@ -138,6 +138,10 @@
"name": "vs/workbench/parts/welcome",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/services/actions",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/services/configuration",
"project": "vscode-workbench"
@ -158,6 +162,10 @@
"name": "vs/workbench/services/extensions",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/services/jsonschemas",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/services/files",
"project": "vscode-workbench"

View file

@ -570,7 +570,7 @@ function processCoreBundleFormat(fileHeader: string, languages: Language[], json
contents.push(index < modules.length - 1 ? '\t],' : '\t]');
});
contents.push('});');
emitter.queue(new File({ path: bundle + '.nls.' + language.id + '.js', contents: new Buffer(contents.join('\n'), 'utf-8') }));
emitter.queue(new File({ path: bundle + '.nls.' + language.id + '.js', contents: Buffer.from(contents.join('\n'), 'utf-8') }));
});
});
Object.keys(statistics).forEach(key => {
@ -667,7 +667,7 @@ export function createXlfFilesForCoreBundle(): ThroughStream {
const filePath = `${xlf.project}/${resource.replace(/\//g, '_')}.xlf`;
const xlfFile = new File({
path: filePath,
contents: new Buffer(xlf.toString(), 'utf8')
contents: Buffer.from(xlf.toString(), 'utf8')
});
this.queue(xlfFile);
}
@ -738,7 +738,7 @@ export function createXlfFilesForExtensions(): ThroughStream {
if (_xlf) {
let xlfFile = new File({
path: path.join(extensionsProject, extensionName + '.xlf'),
contents: new Buffer(_xlf.toString(), 'utf8')
contents: Buffer.from(_xlf.toString(), 'utf8')
});
folderStream.queue(xlfFile);
}
@ -810,7 +810,7 @@ export function createXlfFilesForIsl(): ThroughStream {
// Emit only upon all ISL files combined into single XLF instance
const newFilePath = path.join(projectName, resourceFile);
const xlfFile = new File({ path: newFilePath, contents: new Buffer(xlf.toString(), 'utf-8') });
const xlfFile = new File({ path: newFilePath, contents: Buffer.from(xlf.toString(), 'utf-8') });
this.queue(xlfFile);
});
}
@ -1174,7 +1174,7 @@ function createI18nFile(originalFilePath: string, messages: any): File {
let content = JSON.stringify(result, null, '\t').replace(/\r\n/g, '\n');
return new File({
path: path.join(originalFilePath + '.i18n.json'),
contents: new Buffer(content, 'utf8')
contents: Buffer.from(content, 'utf8')
});
}
@ -1328,7 +1328,7 @@ function createIslFile(originalFilePath: string, messages: Map<string>, language
return new File({
path: filePath,
contents: iconv.encode(new Buffer(content.join('\r\n'), 'utf8'), innoSetup.codePage)
contents: iconv.encode(Buffer.from(content.join('\r\n'), 'utf8'), innoSetup.codePage)
});
}

View file

@ -131,7 +131,7 @@ module nls {
export function fileFrom(file: File, contents: string, path: string = file.path) {
return new File({
contents: new Buffer(contents),
contents: Buffer.from(contents),
base: file.base,
cwd: file.cwd,
path: path

View file

@ -71,7 +71,7 @@ function loader(bundledFileHeader: string, bundleLoader: boolean): NodeJS.ReadWr
this.emit('data', new VinylFile({
path: 'fake',
base: '',
contents: new Buffer(bundledFileHeader)
contents: Buffer.from(bundledFileHeader)
}));
this.emit('data', data);
} else {
@ -115,7 +115,7 @@ function toConcatStream(bundledFileHeader: string, sources: bundle.IFile[], dest
return new VinylFile({
path: source.path ? root + '/' + source.path.replace(/\\/g, '/') : 'fake',
base: base,
contents: new Buffer(source.contents)
contents: Buffer.from(source.contents)
});
});
@ -199,7 +199,7 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
bundleInfoArray.push(new VinylFile({
path: 'bundleInfo.json',
base: '.',
contents: new Buffer(JSON.stringify(result.bundleData, null, '\t'))
contents: Buffer.from(JSON.stringify(result.bundleData, null, '\t'))
}));
}
es.readArray(bundleInfoArray).pipe(bundleInfoStream);

View file

@ -190,7 +190,7 @@ export function loadSourcemaps(): NodeJS.ReadWriteStream {
return;
}
f.contents = new Buffer(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8');
f.contents = Buffer.from(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8');
fs.readFile(path.join(path.dirname(f.path), lastMatch[1]), 'utf8', (err, contents) => {
if (err) { return cb(err); }
@ -209,7 +209,7 @@ export function stripSourceMappingURL(): NodeJS.ReadWriteStream {
const output = input
.pipe(es.mapSync<VinylFile, VinylFile>(f => {
const contents = (<Buffer>f.contents).toString('utf8');
f.contents = new Buffer(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8');
f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8');
return f;
}));

View file

@ -9,7 +9,7 @@ const es = require('event-stream');
function handleDeletions() {
return es.mapSync(f => {
if (/\.ts$/.test(f.relative) && !f.contents) {
f.contents = new Buffer('');
f.contents = Buffer.from('');
f.stat = { mtime: new Date() };
}

View file

@ -30,6 +30,7 @@ const extensions = [
'extension-editing',
'markdown',
'typescript',
'typescript-basics',
'php',
'javascript',
'css',

Binary file not shown.

View file

@ -1,4 +1,4 @@
{
"displayName": "Coffeescript Language Features",
"description": "Provides Syntax highlighting, Folding, Bracket matching, Snippets and other language features in Coffeescript files"
}
"displayName": "CoffeeScript Language Features",
"description": "Provides Syntax highlighting, Folding, Bracket matching, Snippets and other language features in CoffeeScript files"
}

View file

@ -7,7 +7,7 @@
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import * as vscode from 'vscode';
import { getLocation, visit, parse, ParseError, ParseErrorCode } from 'jsonc-parser';
import { getLocation, visit, parse, ParseErrorCode } from 'jsonc-parser';
import * as path from 'path';
import { SettingsDocument } from './settingsDocumentHelper';
@ -70,8 +70,6 @@ function autoFixSettingsJSON(willSaveEvent: vscode.TextDocumentWillSaveEvent): v
onError(error: ParseErrorCode, offset: number, length: number): void {
if (error === ParseErrorCode.CommaExpected && lastEndOfSomething > -1) {
const errorPosition = document.positionAt(offset);
const fixPosition = document.positionAt(lastEndOfSomething);
edit.insert(document.uri, fixPosition, ',');
}
@ -106,30 +104,6 @@ function registerSettingsCompletions(): vscode.Disposable {
});
}
function provideContributedLocalesProposals(range: vscode.Range): vscode.ProviderResult<vscode.CompletionItem[] | vscode.CompletionList> {
const contributedLocales: string[] = [];
for (const extension of vscode.extensions.all) {
if (extension.packageJSON && extension.packageJSON['contributes'] && extension.packageJSON['contributes']['localizations'] && extension.packageJSON['contributes']['localizations'].length) {
const localizations: { languageId: string }[] = extension.packageJSON['contributes']['localizations'];
for (const localization of localizations) {
if (contributedLocales.indexOf(localization.languageId) === -1) {
contributedLocales.push(localization.languageId);
}
}
}
}
return contributedLocales.map(locale => {
const text = `"${locale}"`;
const item = new vscode.CompletionItem(text);
item.kind = vscode.CompletionItemKind.Value;
item.insertText = text;
item.range = range;
item.filterText = text;
return item;
});
}
interface IExtensionsContent {
recommendations: string[];
}

View file

@ -6,9 +6,10 @@
"lib": [
"es2015"
],
"strict": true
"strict": true,
"noUnusedLocals": true
},
"include": [
"src/**/*"
]
}
}

View file

@ -715,7 +715,7 @@
]
},
"dependencies": {
"vscode-languageclient": "^4.0.0-next.9",
"vscode-languageclient": "4.0.0-next.9",
"vscode-nls": "^3.2.1"
},
"devDependencies": {

View file

@ -10,7 +10,7 @@
"dependencies": {
"vscode-css-languageservice": "^3.0.6",
"vscode-emmet-helper": "^1.1.34",
"vscode-languageserver": "^4.0.0-next.4"
"vscode-languageserver": "4.0.0-next.4"
},
"devDependencies": {
"@types/mocha": "2.2.33",

View file

@ -48,7 +48,7 @@ vscode-languageserver-types@^3.6.0-next.1:
version "3.6.0-next.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.0-next.1.tgz#98e488d3f87b666b4ee1a3d89f0023e246d358f3"
vscode-languageserver@^4.0.0-next.4:
vscode-languageserver@4.0.0-next.4:
version "4.0.0-next.4"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.0.0-next.4.tgz#162440b15bedaab07e1676f046e4d9b8578b3d92"
dependencies:

View file

@ -10,7 +10,7 @@ vscode-jsonrpc@^3.6.0-next.1:
version "3.6.0-next.1"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0-next.1.tgz#3cb463dffe5842d6aec16718ca9252708cd6aabe"
vscode-languageclient@^4.0.0-next.9:
vscode-languageclient@4.0.0-next.9:
version "4.0.0-next.9"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.0.0-next.9.tgz#2a06568f46ee9de3490f85e227d3740a21a03d3a"
dependencies:

View file

@ -506,7 +506,7 @@
},
{
"command": "git.showOutput",
"when": "config.git.enabled && gitOpenRepositoryCount != 0"
"when": "config.git.enabled"
},
{
"command": "git.ignore",
@ -1090,7 +1090,7 @@
"byline": "^5.0.0",
"file-type": "^7.2.0",
"iconv-lite": "0.4.19",
"vscode-extension-telemetry": "0.0.13",
"vscode-extension-telemetry": "0.0.14",
"vscode-nls": "^3.2.1",
"which": "^1.3.0"
},

View file

@ -6,7 +6,7 @@
'use strict';
import { Model } from './model';
import { SourceControlInputBox, Uri } from 'vscode';
import { Uri } from 'vscode';
export interface InputBox {
value: string;

View file

@ -5,7 +5,7 @@
'use strict';
import { workspace, Disposable, EventEmitter, Memento, window, MessageItem, ConfigurationTarget, commands, Uri } from 'vscode';
import { workspace, Disposable, EventEmitter, Memento, window, MessageItem, ConfigurationTarget } from 'vscode';
import { GitErrorCodes } from './git';
import { Repository, Operation } from './repository';
import { eventToPromise, filterEvent, onceEvent } from './util';
@ -54,20 +54,14 @@ export class AutoFetcher {
}
const yes: MessageItem = { title: localize('yes', "Yes") };
const readMore: MessageItem = { title: localize('read more', "Read More") };
const no: MessageItem = { isCloseAffordance: true, title: localize('no', "No") };
const askLater: MessageItem = { title: localize('not now', "Ask Me Later") };
const result = await window.showInformationMessage(localize('suggest auto fetch', "Would you like Code to periodically run 'git fetch'?"), yes, readMore, no, askLater);
const result = await window.showInformationMessage(localize('suggest auto fetch', "Would you like Code to [periodically run 'git fetch']({0})?", 'https://go.microsoft.com/fwlink/?linkid=865294'), yes, no, askLater);
if (result === askLater) {
return;
}
if (result === readMore) {
commands.executeCommand('vscode.open', Uri.parse('https://go.microsoft.com/fwlink/?linkid=865294'));
return this.onFirstGoodRemoteOperation();
}
if (result === yes) {
const gitConfig = workspace.getConfiguration('git');
gitConfig.update('autofetch', true, ConfigurationTarget.Global);

View file

@ -7,10 +7,10 @@
import { Uri, commands, Disposable, window, workspace, QuickPickItem, OutputChannel, Range, WorkspaceEdit, Position, LineChange, SourceControlResourceState, TextDocumentShowOptions, ViewColumn, ProgressLocation, TextEditor, CancellationTokenSource, StatusBarAlignment } from 'vscode';
import { Ref, RefType, Git, GitErrorCodes, Branch } from './git';
import { Repository, Resource, Status, CommitOptions, ResourceGroupType, RepositoryState } from './repository';
import { Repository, Resource, Status, CommitOptions, ResourceGroupType } from './repository';
import { Model } from './model';
import { toGitUri, fromGitUri } from './uri';
import { grep, eventToPromise, isDescendant } from './util';
import { grep, isDescendant } from './util';
import { applyLineChanges, intersectDiffWithRange, toLineRanges, invertLineChange, getModifiedRange } from './staging';
import * as path from 'path';
import { lstat, Stats } from 'fs';
@ -237,7 +237,7 @@ export class CommandCenter {
}
const { size, object } = await repository.lstree(gitRef, uri.fsPath);
const { mimetype, encoding } = await repository.detectObjectType(object);
const { mimetype } = await repository.detectObjectType(object);
if (mimetype === 'text/plain') {
return toGitUri(uri, ref);
@ -1051,13 +1051,6 @@ export class CommandCenter {
value = (await repository.getCommit(repository.HEAD.commit)).message;
}
const getPreviousCommitMessage = async () => {
//Only return the previous commit message if it's an amend commit and the repo already has a commit
if (opts && opts.amend && repository.HEAD && repository.HEAD.commit) {
return (await repository.getCommit('HEAD')).message;
}
};
return await window.showInputBox({
value,
placeHolder: localize('commit message', "Commit message"),

View file

@ -10,8 +10,8 @@ import * as path from 'path';
import { Repository, GitResourceGroup, Status } from './repository';
import { Model } from './model';
import { debounce } from './decorators';
import { filterEvent, dispose, anyEvent, mapEvent, fireEvent } from './util';
import { Submodule, GitErrorCodes } from './git';
import { filterEvent, dispose, anyEvent, fireEvent } from './util';
import { GitErrorCodes } from './git';
type Callback = { resolve: (status: boolean) => void, reject: (err: any) => void };

View file

@ -78,7 +78,7 @@ function _throttle<T>(fn: Function, key: string): Function {
export const throttle = decorate(_throttle);
function _sequentialize<T>(fn: Function, key: string): Function {
function _sequentialize(fn: Function, key: string): Function {
const currentKey = `__$sequence$${key}`;
return function (this: any, ...args: any[]) {

View file

@ -362,7 +362,6 @@ function getGitErrorCode(stderr: string): string | undefined {
export class Git {
private gitPath: string;
private version: string;
private env: any;
private _onOutput = new EventEmitter();
@ -370,7 +369,6 @@ export class Git {
constructor(options: IGitOptions) {
this.gitPath = options.gitPath;
this.version = options.version;
this.env = options.env || {};
}
@ -463,7 +461,7 @@ export class Git {
});
if (options.log !== false) {
this.log(`git ${args.join(' ')}\n`);
this.log(`> git ${args.join(' ')}\n`);
}
return cp.spawn(this.gitPath, args, options);

View file

@ -14,7 +14,7 @@ import { CommandCenter } from './commands';
import { GitContentProvider } from './contentProvider';
import { GitDecorations } from './decorationProvider';
import { Askpass } from './askpass';
import { toDisposable, filterEvent, mapEvent, eventToPromise } from './util';
import { toDisposable, filterEvent, eventToPromise } from './util';
import TelemetryReporter from 'vscode-extension-telemetry';
import { API, createApi } from './api';
@ -26,7 +26,7 @@ async function init(context: ExtensionContext, outputChannel: OutputChannel, dis
const askpass = new Askpass();
const env = await askpass.getEnv();
const git = new Git({ gitPath: info.path, version: info.version, env });
const model = new Model(git, context.globalState);
const model = new Model(git, context.globalState, outputChannel);
disposables.push(model);
const onRepository = () => commands.executeCommand('setContext', 'gitOpenRepositoryCount', `${model.repositories.length}`);
@ -36,7 +36,15 @@ async function init(context: ExtensionContext, outputChannel: OutputChannel, dis
outputChannel.appendLine(localize('using git', "Using git {0} from {1}", info.version, info.path));
const onOutput = (str: string) => outputChannel.append(str);
const onOutput = (str: string) => {
const lines = str.split(/\r?\n/mg);
while (/^\s*$/.test(lines[lines.length - 1])) {
lines.pop();
}
outputChannel.appendLine(lines.join('\n'));
};
git.onOutput.addListener('log', onOutput);
disposables.push(toDisposable(() => git.onOutput.removeListener('log', onOutput)));

View file

@ -5,10 +5,10 @@
'use strict';
import { workspace, WorkspaceFoldersChangeEvent, Uri, window, Event, EventEmitter, QuickPickItem, Disposable, SourceControl, SourceControlResourceGroup, TextEditor, Memento, ConfigurationChangeEvent } from 'vscode';
import { workspace, WorkspaceFoldersChangeEvent, Uri, window, Event, EventEmitter, QuickPickItem, Disposable, SourceControl, SourceControlResourceGroup, TextEditor, Memento, OutputChannel } from 'vscode';
import { Repository, RepositoryState } from './repository';
import { memoize, sequentialize, debounce } from './decorators';
import { dispose, anyEvent, filterEvent, IDisposable, isDescendant, find, firstIndex } from './util';
import { dispose, anyEvent, filterEvent, isDescendant, firstIndex } from './util';
import { Git, GitErrorCodes } from './git';
import * as path from 'path';
import * as fs from 'fs';
@ -66,7 +66,7 @@ export class Model {
private disposables: Disposable[] = [];
constructor(private git: Git, private globalState: Memento) {
constructor(private git: Git, private globalState: Memento, private outputChannel: OutputChannel) {
workspace.onDidChangeWorkspaceFolders(this.onDidChangeWorkspaceFolders, this, this.disposables);
this.onDidChangeWorkspaceFolders({ added: workspace.workspaceFolders || [], removed: [] });
@ -93,11 +93,16 @@ export class Model {
private async scanWorkspaceFolders(): Promise<void> {
for (const folder of workspace.workspaceFolders || []) {
const root = folder.uri.fsPath;
const children = await new Promise<string[]>((c, e) => fs.readdir(root, (err, r) => err ? e(err) : c(r)));
children
.filter(child => child !== '.git')
.forEach(child => this.tryOpenRepository(path.join(root, child)));
try {
const children = await new Promise<string[]>((c, e) => fs.readdir(root, (err, r) => err ? e(err) : c(r)));
children
.filter(child => child !== '.git')
.forEach(child => this.tryOpenRepository(path.join(root, child)));
} catch (err) {
// noop
}
}
}
@ -215,13 +220,25 @@ export class Model {
}
private open(repository: Repository): void {
this.outputChannel.appendLine(`Open repository: ${repository.root}`);
const onDidDisappearRepository = filterEvent(repository.onDidChangeState, state => state === RepositoryState.Disposed);
const disappearListener = onDidDisappearRepository(() => dispose());
const changeListener = repository.onDidChangeRepository(uri => this._onDidChangeRepository.fire({ repository, uri }));
const originalResourceChangeListener = repository.onDidChangeOriginalResource(uri => this._onDidChangeOriginalResource.fire({ repository, uri }));
const statusListener = repository.onDidRunGitStatus(() => this.scanSubmodules(repository));
this.scanSubmodules(repository);
const checkForSubmodules = () => {
if (repository.submodules.length > 10) {
window.showWarningMessage(localize('too many submodules', "The '{0}' repository has {1} submodules which won't be opened automatically. You can still open each one individually by opening a file within.", path.basename(repository.root), repository.submodules.length));
statusListener.dispose();
return;
}
this.scanSubmodules(repository);
};
const statusListener = repository.onDidRunGitStatus(checkForSubmodules);
checkForSubmodules();
const dispose = () => {
disappearListener.dispose();
@ -260,6 +277,7 @@ export class Model {
return;
}
this.outputChannel.appendLine(`Close repository: ${repository.root}`);
openRepository.dispose();
}

View file

@ -398,7 +398,7 @@ class ProgressManager {
private disposable: IDisposable = EmptyDisposable;
constructor(private repository: Repository) {
constructor(repository: Repository) {
const start = onceEvent(filterEvent(repository.onDidChangeOperations, () => repository.operations.shouldShowProgress()));
const end = onceEvent(filterEvent(debounceEvent(repository.onDidChangeOperations, 300), () => !repository.operations.shouldShowProgress()));
@ -790,8 +790,8 @@ export class Repository implements Disposable {
async buffer(ref: string, filePath: string): Promise<Buffer> {
return await this.run(Operation.Show, async () => {
const relativePath = path.relative(this.repository.root, filePath).replace(/\\/g, '/');
const configFiles = workspace.getConfiguration('files', Uri.file(filePath));
const encoding = configFiles.get<string>('encoding');
// const configFiles = workspace.getConfiguration('files', Uri.file(filePath));
// const encoding = configFiles.get<string>('encoding');
// TODO@joao: REsource config api
return await this.repository.buffer(`${ref}:${relativePath}`);
@ -954,10 +954,9 @@ export class Repository implements Disposable {
this.isRepositoryHuge = didHitLimit;
if (didHitLimit && !shouldIgnore && !this.didWarnAboutLimit) {
const ok = { title: localize('ok', "OK"), isCloseAffordance: true };
const neverAgain = { title: localize('neveragain', "Don't Show Again") };
window.showWarningMessage(localize('huge', "The git repository at '{0}' has too many active changes, only a subset of Git features will be enabled.", this.repository.root), ok, neverAgain).then(result => {
window.showWarningMessage(localize('huge', "The git repository at '{0}' has too many active changes, only a subset of Git features will be enabled.", this.repository.root), neverAgain).then(result => {
if (result === neverAgain) {
config.update('ignoreLimitWarning', true, false);
}
@ -1009,10 +1008,8 @@ export class Repository implements Disposable {
case 'UU': return merge.push(new Resource(ResourceGroupType.Merge, uri, Status.BOTH_MODIFIED, useIcons));
}
let isModifiedInIndex = false;
switch (raw.x) {
case 'M': index.push(new Resource(ResourceGroupType.Index, uri, Status.INDEX_MODIFIED, useIcons)); isModifiedInIndex = true; break;
case 'M': index.push(new Resource(ResourceGroupType.Index, uri, Status.INDEX_MODIFIED, useIcons)); break;
case 'A': index.push(new Resource(ResourceGroupType.Index, uri, Status.INDEX_ADDED, useIcons)); break;
case 'D': index.push(new Resource(ResourceGroupType.Index, uri, Status.INDEX_DELETED, useIcons)); break;
case 'R': index.push(new Resource(ResourceGroupType.Index, uri, Status.INDEX_RENAMED, useIcons, renameUri)); break;

View file

@ -239,7 +239,7 @@ export async function grep(filename: string, pattern: RegExp): Promise<boolean>
export function readBytes(stream: Readable, bytes: number): Promise<Buffer> {
return new Promise<Buffer>((complete, error) => {
let done = false;
let buffer = new Buffer(bytes);
let buffer = Buffer.allocUnsafe(bytes);
let bytesRead = 0;
stream.on('data', (data: Buffer) => {

View file

@ -10,7 +10,8 @@
"./node_modules/@types"
],
"strict": true,
"experimentalDecorators": true
"experimentalDecorators": true,
"noUnusedLocals": true
},
"include": [
"src/**/*"

View file

@ -253,9 +253,9 @@ supports-color@3.1.2:
dependencies:
has-flag "^1.0.0"
vscode-extension-telemetry@0.0.13:
version "0.0.13"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.13.tgz#8a4438cbb0a9f9f8ad65479e4ec08683aa4de0f7"
vscode-extension-telemetry@0.0.14:
version "0.0.14"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.14.tgz#17454705b6bb8757351b955d812923f02ee895bf"
dependencies:
applicationinsights "1.0.1"

View file

@ -8,12 +8,14 @@ import * as path from 'path';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { languages, ExtensionContext, IndentAction, Position, TextDocument, Range, CompletionItem, CompletionItemKind, SnippetString } from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, RequestType, TextDocumentPositionParams } from 'vscode-languageclient';
import { languages, ExtensionContext, IndentAction, Position, TextDocument, Range, CompletionItem, CompletionItemKind, SnippetString, FoldingRangeList, FoldingRange, workspace } from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, RequestType, TextDocumentPositionParams, Disposable } from 'vscode-languageclient';
import { EMPTY_ELEMENTS } from './htmlEmptyTagsShared';
import { activateTagClosing } from './tagClosing';
import TelemetryReporter from 'vscode-extension-telemetry';
import { FoldingRangesRequest } from './protocol/foldingProvider.proposed';
namespace TagCloseRequest {
export const type: RequestType<TextDocumentPositionParams, string, any, any> = new RequestType('html/tag');
}
@ -26,6 +28,9 @@ interface IPackageInfo {
let telemetryReporter: TelemetryReporter | null;
let foldingProviderRegistration: Disposable | undefined = void 0;
const foldingSetting = 'html.experimental.syntaxFolding';
export function activate(context: ExtensionContext) {
let toDispose = context.subscriptions;
@ -78,6 +83,14 @@ export function activate(context: ExtensionContext) {
}
});
toDispose.push(disposable);
initFoldingProvider();
toDispose.push(workspace.onDidChangeConfiguration(c => {
if (c.affectsConfiguration(foldingSetting)) {
initFoldingProvider();
}
}));
toDispose.push({ dispose: () => foldingProviderRegistration && foldingProviderRegistration.dispose() });
});
languages.setLanguageConfiguration('html', {
@ -153,6 +166,29 @@ export function activate(context: ExtensionContext) {
return null;
}
});
function initFoldingProvider() {
let enable = workspace.getConfiguration().get(foldingSetting);
if (enable) {
if (!foldingProviderRegistration) {
foldingProviderRegistration = languages.registerFoldingProvider(documentSelector, {
provideFoldingRanges(document: TextDocument) {
return client.sendRequest(FoldingRangesRequest.type, { textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document) }).then(res => {
if (res && Array.isArray(res.ranges)) {
return new FoldingRangeList(res.ranges.map(r => new FoldingRange(r.startLine, r.endLine, r.type)));
}
return null;
});
}
});
}
} else {
if (foldingProviderRegistration) {
foldingProviderRegistration.dispose();
foldingProviderRegistration = void 0;
}
}
}
}
function getPackageInfo(context: ExtensionContext): IPackageInfo | null {

View file

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { TextDocumentIdentifier } from 'vscode-languageserver-types';
import { RequestType, TextDocumentRegistrationOptions, StaticRegistrationOptions } from 'vscode-languageserver-protocol';
// ---- capabilities
export interface FoldingProviderClientCapabilities {
/**
* The text document client capabilities
*/
textDocument?: {
/**
* Capabilities specific to the foldingProvider
*/
foldingProvider?: {
/**
* Whether implementation supports dynamic registration. If this is set to `true`
* the client supports the new `(FoldingProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
* return value for the corresponding server capability as well.
*/
dynamicRegistration?: boolean;
};
};
}
export interface FoldingProviderOptions {
}
export interface FoldingProviderServerCapabilities {
/**
* The server provides folding provider support.
*/
foldingProvider?: FoldingProviderOptions | (FoldingProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions);
}
export interface FoldingRangeList {
/**
* The folding ranges.
*/
ranges: FoldingRange[];
}
export enum FoldingRangeType {
/**
* Folding range for a comment
*/
Comment = 'comment',
/**
* Folding range for a imports or includes
*/
Imports = 'imports',
/**
* Folding range for a region (e.g. `#region`)
*/
Region = 'region'
}
export interface FoldingRange {
/**
* The start line number
*/
startLine: number;
/**
* The end line number
*/
endLine: number;
/**
* The actual color value for this folding range.
*/
type?: FoldingRangeType | string;
}
export interface FoldingRangeRequestParam {
/**
* The text document.
*/
textDocument: TextDocumentIdentifier;
}
export namespace FoldingRangesRequest {
export const type: RequestType<FoldingRangeRequestParam, FoldingRangeList | null, any, any> = new RequestType('textDocument/foldingRanges');
}

View file

@ -213,6 +213,11 @@
"default": true,
"description": "%html.autoClosingTags%"
},
"html.experimental.syntaxFolding": {
"type": "boolean",
"default": false,
"description": "%html.experimental.syntaxFolding%"
},
"html.trace.server": {
"type": "string",
"scope": "window",
@ -228,8 +233,8 @@
}
},
"dependencies": {
"vscode-extension-telemetry": "0.0.13",
"vscode-languageclient": "^4.0.0-next.9",
"vscode-extension-telemetry": "0.0.14",
"vscode-languageclient": "4.0.0-next.9",
"vscode-nls": "^3.2.1"
},
"devDependencies": {

View file

@ -22,5 +22,6 @@
"html.trace.server.desc": "Traces the communication between VS Code and the HTML language server.",
"html.validate.scripts": "Configures if the built-in HTML language support validates embedded scripts.",
"html.validate.styles": "Configures if the built-in HTML language support validates embedded styles.",
"html.experimental.syntaxFolding": "Enables/disables syntax aware folding markers.",
"html.autoClosingTags": "Enable/disable autoclosing of HTML tags."
}

View file

@ -20,6 +20,8 @@ import { formatError, runSafe } from './utils/errors';
import { doComplete as emmetDoComplete, updateExtensionsPath as updateEmmetExtensionsPath, getEmmetCompletionParticipants } from 'vscode-emmet-helper';
import { getPathCompletionParticipant } from './modes/pathCompletion';
import { FoldingRangesRequest, FoldingProviderServerCapabilities } from './protocol/foldingProvider.proposed';
namespace TagCloseRequest {
export const type: RequestType<TextDocumentPositionParams, string | null, any, any> = new RequestType('html/tag');
}
@ -33,6 +35,9 @@ console.error = connection.console.error.bind(connection.console);
process.on('unhandledRejection', (e: any) => {
connection.console.error(formatError(`Unhandled exception`, e));
});
process.on('uncaughtException', (e) => {
connection.console.error(formatError(`Unhandled exception`, e));
});
// Create a simple text document manager. The text document manager
// supports full document sync only
@ -108,7 +113,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
clientDynamicRegisterSupport = hasClientCapability('workspace', 'symbol', 'dynamicRegistration');
scopedSettingsSupport = hasClientCapability('workspace', 'configuration');
workspaceFoldersSupport = hasClientCapability('workspace', 'workspaceFolders');
let capabilities: ServerCapabilities & CPServerCapabilities = {
let capabilities: ServerCapabilities & CPServerCapabilities & FoldingProviderServerCapabilities = {
// Tell the client that the server works in FULL text document sync mode
textDocumentSync: documents.syncKind,
completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: [...emmetTriggerCharacters, '.', ':', '<', '"', '=', '/'] } : undefined,
@ -120,7 +125,8 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
definitionProvider: true,
signatureHelpProvider: { triggerCharacters: ['('] },
referencesProvider: true,
colorProvider: true
colorProvider: true,
foldingProvider: true
};
return { capabilities };
});
@ -456,6 +462,20 @@ connection.onRequest(TagCloseRequest.type, params => {
}, null, `Error while computing tag close actions for ${params.textDocument.uri}`);
});
connection.onRequest(FoldingRangesRequest.type, params => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
if (document) {
let mode = languageModes.getMode('html');
if (mode && mode.getFoldingRanges) {
return mode.getFoldingRanges(document);
}
return null;
}
return null;
}, null, `Error while computing folding regions for ${params.textDocument.uri}`);
});
// Listen on the connection
connection.listen();

View file

@ -9,6 +9,8 @@ import { LanguageService as HTMLLanguageService, HTMLDocument, DocumentContext,
import { TextDocument, Position, Range } from 'vscode-languageserver-types';
import { LanguageMode, Settings } from './languageModes';
import { FoldingRangeType, FoldingRange, FoldingRangeList } from '../protocol/foldingProvider.proposed';
export function getHTMLMode(htmlLanguageService: HTMLLanguageService): LanguageMode {
let globalSettings: Settings = {};
let htmlDocuments = getLanguageModelCache<HTMLDocument>(10, 60, document => htmlLanguageService.parseHTMLDocument(document));
@ -62,6 +64,80 @@ export function getHTMLMode(htmlLanguageService: HTMLLanguageService): LanguageM
formatSettings = merge(formatParams, formatSettings);
return htmlLanguageService.format(document, range, formatSettings);
},
getFoldingRanges(document: TextDocument): FoldingRangeList {
const scanner = htmlLanguageService.createScanner(document.getText());
let token = scanner.scan();
let ranges: FoldingRange[] = [];
let stack: FoldingRange[] = [];
let elementNames: string[] = [];
let lastTagName = null;
let prevStart = -1;
while (token !== TokenType.EOS) {
switch (token) {
case TokenType.StartTagOpen: {
let startLine = document.positionAt(scanner.getTokenOffset()).line;
let range = { startLine, endLine: startLine };
stack.push(range);
break;
}
case TokenType.StartTag: {
lastTagName = scanner.getTokenText();
elementNames.push(lastTagName);
break;
}
case TokenType.EndTag: {
lastTagName = scanner.getTokenText();
break;
}
case TokenType.EndTagClose:
case TokenType.StartTagSelfClose: {
let name = elementNames.pop();
let range = stack.pop();
while (name && name !== lastTagName) {
name = elementNames.pop();
range = stack.pop();
}
let line = document.positionAt(scanner.getTokenOffset()).line;
if (range && line > range.startLine + 1 && prevStart !== range.startLine) {
range.endLine = line - 1;
ranges.push(range);
prevStart = range.startLine;
}
break;
}
case TokenType.Comment: {
let text = scanner.getTokenText();
let m = text.match(/^\s*#(region\b)|(endregion\b)/);
if (m) {
let line = document.positionAt(scanner.getTokenOffset()).line;
if (m[1]) { // start pattern match
let range = { startLine: line, endLine: line, type: FoldingRangeType.Region };
stack.push(range);
elementNames.push('');
} else {
let i = stack.length - 1;
while (i >= 0 && stack[i].type !== FoldingRangeType.Region) {
i--;
}
if (i >= 0) {
let range = stack[i];
stack.length = i;
if (line > range.startLine && prevStart !== range.startLine) {
range.endLine = line;
ranges.push(range);
prevStart = range.startLine;
}
}
}
}
break;
}
}
token = scanner.scan();
}
return <FoldingRangeList>{ ranges };
},
doAutoClose(document: TextDocument, position: Position) {
let offset = document.offsetAt(position);
let text = document.getText();

View file

@ -20,6 +20,8 @@ import { getHTMLMode } from './htmlMode';
export { ColorInformation, ColorPresentation, Color };
import { FoldingRangeList } from '../protocol/foldingProvider.proposed';
export interface Settings {
css?: any;
html?: any;
@ -49,6 +51,7 @@ export interface LanguageMode {
findDocumentColors?: (document: TextDocument) => ColorInformation[];
getColorPresentations?: (document: TextDocument, color: Color, range: Range) => ColorPresentation[];
doAutoClose?: (document: TextDocument, position: Position) => string | null;
getFoldingRanges?: (document: TextDocument) => FoldingRangeList | null;
onDocumentRemoved(document: TextDocument): void;
dispose(): void;
}

View file

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { TextDocumentIdentifier } from 'vscode-languageserver-types';
import { RequestType, TextDocumentRegistrationOptions, StaticRegistrationOptions } from 'vscode-languageserver-protocol';
// ---- capabilities
export interface FoldingProviderClientCapabilities {
/**
* The text document client capabilities
*/
textDocument?: {
/**
* Capabilities specific to the foldingProvider
*/
foldingProvider?: {
/**
* Whether implementation supports dynamic registration. If this is set to `true`
* the client supports the new `(FoldingProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
* return value for the corresponding server capability as well.
*/
dynamicRegistration?: boolean;
};
};
}
export interface FoldingProviderOptions {
}
export interface FoldingProviderServerCapabilities {
/**
* The server provides folding provider support.
*/
foldingProvider?: FoldingProviderOptions | (FoldingProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions);
}
export interface FoldingRangeList {
/**
* The folding ranges.
*/
ranges: FoldingRange[];
}
export enum FoldingRangeType {
/**
* Folding range for a comment
*/
Comment = 'comment',
/**
* Folding range for a imports or includes
*/
Imports = 'imports',
/**
* Folding range for a region (e.g. `#region`)
*/
Region = 'region'
}
export interface FoldingRange {
/**
* The start line number
*/
startLine: number;
/**
* The end line number
*/
endLine: number;
/**
* The actual color value for this folding range.
*/
type?: FoldingRangeType | string;
}
export interface FoldingRangeRequestParam {
/**
* The text document.
*/
textDocument: TextDocumentIdentifier;
}
export namespace FoldingRangesRequest {
export const type: RequestType<FoldingRangeRequestParam, FoldingRangeList | null, any, any> = new RequestType('textDocument/foldingRanges');
}

View file

@ -8,5 +8,8 @@
"lib": [
"es5", "es2015.promise"
]
}
},
"include": [
"src"
]
}

View file

@ -56,7 +56,7 @@ vscode-languageserver-types@^3.6.0-next.1:
version "3.6.0-next.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.0-next.1.tgz#98e488d3f87b666b4ee1a3d89f0023e246d358f3"
vscode-languageserver@^4.0.0-next.4:
vscode-languageserver@4.0.0-next.4:
version "4.0.0-next.4"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.0.0-next.4.tgz#162440b15bedaab07e1676f046e4d9b8578b3d92"
dependencies:

View file

@ -28,9 +28,9 @@ semver@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
vscode-extension-telemetry@0.0.13:
version "0.0.13"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.13.tgz#8a4438cbb0a9f9f8ad65479e4ec08683aa4de0f7"
vscode-extension-telemetry@0.0.14:
version "0.0.14"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.14.tgz#17454705b6bb8757351b955d812923f02ee895bf"
dependencies:
applicationinsights "1.0.1"
@ -38,7 +38,7 @@ vscode-jsonrpc@^3.6.0-next.1:
version "3.6.0-next.1"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0-next.1.tgz#3cb463dffe5842d6aec16718ca9252708cd6aabe"
vscode-languageclient@^4.0.0-next.9:
vscode-languageclient@4.0.0-next.9:
version "4.0.0-next.9"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.0.0-next.9.tgz#2a06568f46ee9de3490f85e227d3740a21a03d3a"
dependencies:

View file

@ -1,29 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceFolder}/out",
"preLaunchTask": "npm"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out/test" ],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceFolder}/out/test",
"preLaunchTask": "npm"
}
]
}

View file

@ -1,30 +0,0 @@
// Available variables which can be used inside of strings.
// ${workspaceFolder}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
// A task runner that calls a custom npm script that compiles the extension.
{
"version": "0.1.0",
// we want to run npm
"command": "npm",
// the command is a shell script
"isShellCommand": true,
// show the output window only if unrecognized errors occur.
"showOutput": "silent",
// we run the custom script "compile" as defined in package.json
"args": ["run", "compile"],
// The tsc compiler is started in watching mode
"isWatching": true,
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
"problemMatcher": "$tsc-watch"
}

View file

@ -1,24 +1,12 @@
{
"name": "javascript",
"displayName": "%displayName%",
"description": "%description%",
"version": "0.1.0",
"publisher": "vscode",
"engines": {
"vscode": "0.10.x"
},
"activationEvents": [
"onLanguage:javascript",
"onLanguage:json"
],
"main": "./out/javascriptMain",
"dependencies": {
"jsonc-parser": "^1.0.0",
"request-light": "^0.2.2",
"vscode-nls": "^3.2.1"
},
"scripts": {
"compile": "gulp compile-extension:javascript",
"watch": "gulp watch-extension:javascript"
},
"contributes": {
"languages": [
{
@ -99,14 +87,6 @@
}
],
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "https://schemastore.azurewebsites.net/schemas/json/package.json"
},
{
"fileMatch": "bower.json",
"url": "https://schemastore.azurewebsites.net/schemas/json/bower.json"
},
{
"fileMatch": ".bowerrc",
"url": "https://schemastore.azurewebsites.net/schemas/json/bowerrc.json"
@ -136,8 +116,5 @@
"url": "./schemas/jsconfig.schema.json"
}
]
},
"devDependencies": {
"@types/node": "8.0.33"
}
}
}

View file

@ -0,0 +1,4 @@
{
"displayName": "JavaScript Language Features",
"description": "Provides syntax highlighting and basic language support for JavaScript."
}

View file

@ -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';
import { addJSONProviders } from './features/jsonContributions';
import * as httpRequest from 'request-light';
import { ExtensionContext, workspace } from 'vscode';
export function activate(context: ExtensionContext): any {
configureHttpRequest();
workspace.onDidChangeConfiguration(() => configureHttpRequest());
context.subscriptions.push(addJSONProviders(httpRequest.xhr));
}
function configureHttpRequest() {
const httpSettings = workspace.getConfiguration('http');
httpRequest.configure(httpSettings.get<string>('proxy', ''), httpSettings.get<boolean>('proxyStrictSSL', true));
}

View file

@ -1,7 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../src/vs/vscode.d.ts'/>
/// <reference types='@types/node'/>

View file

@ -1,18 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"outDir": "./out",
"lib": [
"es2015"
],
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true
},
"include": [
"src/**/*"
]
}

View file

@ -1,77 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@types/node@8.0.33":
version "8.0.33"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.33.tgz#1126e94374014e54478092830704f6ea89df04cd"
agent-base@4, agent-base@^4.1.0:
version "4.1.2"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.1.2.tgz#80fa6cde440f4dcf9af2617cf246099b5d99f0c8"
dependencies:
es6-promisify "^5.0.0"
debug@2:
version "2.2.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da"
dependencies:
ms "0.7.1"
debug@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
dependencies:
ms "2.0.0"
es6-promise@^4.0.3:
version "4.1.1"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.1.1.tgz#8811e90915d9a0dba36274f0b242dbda78f9c92a"
es6-promisify@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
dependencies:
es6-promise "^4.0.3"
http-proxy-agent@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.0.0.tgz#46482a2f0523a4d6082551709f469cb3e4a85ff4"
dependencies:
agent-base "4"
debug "2"
https-proxy-agent@2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.1.1.tgz#a7ce4382a1ba8266ee848578778122d491260fd9"
dependencies:
agent-base "^4.1.0"
debug "^3.1.0"
jsonc-parser@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-1.0.0.tgz#ddcc864ae708e60a7a6dd36daea00172fa8d9272"
ms@0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
request-light@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/request-light/-/request-light-0.2.2.tgz#53e48af32ad1514e45221ea5ece5ce782720f712"
dependencies:
http-proxy-agent "2.0.0"
https-proxy-agent "2.1.1"
vscode-nls "^2.0.2"
vscode-nls@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-2.0.2.tgz#808522380844b8ad153499af5c3b03921aea02da"
vscode-nls@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.1.tgz#b1f3e04e8a94a715d5a7bcbc8339c51e6d74ca51"

View file

@ -8,10 +8,12 @@ import * as path from 'path';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { workspace, languages, ExtensionContext, extensions, Uri, LanguageConfiguration } from 'vscode';
import { workspace, languages, ExtensionContext, extensions, Uri, LanguageConfiguration, TextDocument, FoldingRangeList, FoldingRange, Disposable } from 'vscode';
import { LanguageClient, LanguageClientOptions, RequestType, ServerOptions, TransportKind, NotificationType, DidChangeConfigurationNotification } from 'vscode-languageclient';
import TelemetryReporter from 'vscode-extension-telemetry';
import { FoldingRangesRequest } from './protocol/foldingProvider.proposed';
import { hash } from './utils/hash';
namespace VSCodeContentRequest {
@ -55,6 +57,9 @@ interface JSONSchemaSettings {
let telemetryReporter: TelemetryReporter | undefined;
let foldingProviderRegistration: Disposable | undefined = void 0;
const foldingSetting = 'json.experimental.syntaxFolding';
export function activate(context: ExtensionContext) {
let toDispose = context.subscriptions;
@ -99,7 +104,7 @@ export function activate(context: ExtensionContext) {
let disposable = client.start();
toDispose.push(disposable);
client.onReady().then(() => {
client.onTelemetry(e => {
disposable = client.onTelemetry(e => {
if (telemetryReporter) {
telemetryReporter.sendTelemetryEvent(e.key, e.data);
}
@ -124,6 +129,14 @@ export function activate(context: ExtensionContext) {
toDispose.push(workspace.onDidCloseTextDocument(d => handleContentChange(d.uri)));
client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociation(context));
initFoldingProvider();
toDispose.push(workspace.onDidChangeConfiguration(c => {
if (c.affectsConfiguration(foldingSetting)) {
initFoldingProvider();
}
}));
toDispose.push({ dispose: () => foldingProviderRegistration && foldingProviderRegistration.dispose() });
});
let languageConfiguration: LanguageConfiguration = {
@ -135,6 +148,29 @@ export function activate(context: ExtensionContext) {
};
languages.setLanguageConfiguration('json', languageConfiguration);
languages.setLanguageConfiguration('jsonc', languageConfiguration);
function initFoldingProvider() {
let enable = workspace.getConfiguration().get(foldingSetting);
if (enable) {
if (!foldingProviderRegistration) {
foldingProviderRegistration = languages.registerFoldingProvider(documentSelector, {
provideFoldingRanges(document: TextDocument) {
return client.sendRequest(FoldingRangesRequest.type, { textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document) }).then(res => {
if (res && Array.isArray(res.ranges)) {
return new FoldingRangeList(res.ranges.map(r => new FoldingRange(r.startLine, r.endLine, r.type)));
}
return null;
});
}
});
}
} else {
if (foldingProviderRegistration) {
foldingProviderRegistration.dispose();
foldingProviderRegistration = void 0;
}
}
}
}
export function deactivate(): Promise<any> {

View file

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { TextDocumentIdentifier } from 'vscode-languageserver-types';
import { RequestType, TextDocumentRegistrationOptions, StaticRegistrationOptions } from 'vscode-languageserver-protocol';
// ---- capabilities
export interface FoldingProviderClientCapabilities {
/**
* The text document client capabilities
*/
textDocument?: {
/**
* Capabilities specific to the foldingProvider
*/
foldingProvider?: {
/**
* Whether implementation supports dynamic registration. If this is set to `true`
* the client supports the new `(FoldingProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
* return value for the corresponding server capability as well.
*/
dynamicRegistration?: boolean;
};
};
}
export interface FoldingProviderOptions {
}
export interface FoldingProviderServerCapabilities {
/**
* The server provides folding provider support.
*/
foldingProvider?: FoldingProviderOptions | (FoldingProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions);
}
export interface FoldingRangeList {
/**
* The folding ranges.
*/
ranges: FoldingRange[];
}
export enum FoldingRangeType {
/**
* Folding range for a comment
*/
Comment = 'comment',
/**
* Folding range for a imports or includes
*/
Imports = 'imports',
/**
* Folding range for a region (e.g. `#region`)
*/
Region = 'region'
}
export interface FoldingRange {
/**
* The start line number
*/
startLine: number;
/**
* The end line number
*/
endLine: number;
/**
* The actual color value for this folding range.
*/
type?: FoldingRangeType | string;
}
export interface FoldingRangeRequestParam {
/**
* The text document.
*/
textDocument: TextDocumentIdentifier;
}
export namespace FoldingRangesRequest {
export const type: RequestType<FoldingRangeRequestParam, FoldingRangeList | null, any, any> = new RequestType('textDocument/foldingRanges');
}

View file

@ -152,6 +152,11 @@
"default": true,
"description": "%json.colorDecorators.enable.desc%",
"deprecationMessage": "%json.colorDecorators.enable.deprecationMessage%"
},
"json.experimental.syntaxFolding": {
"type": "boolean",
"default": false,
"description": "%json.experimental.syntaxFolding%"
}
}
},
@ -164,8 +169,8 @@
}
},
"dependencies": {
"vscode-extension-telemetry": "0.0.13",
"vscode-languageclient": "^4.0.0-next.9",
"vscode-extension-telemetry": "0.0.14",
"vscode-languageclient": "4.0.0-next.9",
"vscode-nls": "^3.2.1"
},
"devDependencies": {

View file

@ -9,5 +9,6 @@
"json.format.enable.desc": "Enable/disable default JSON formatter (requires restart)",
"json.tracing.desc": "Traces the communication between VS Code and the JSON language server.",
"json.colorDecorators.enable.desc": "Enables or disables color decorators",
"json.colorDecorators.enable.deprecationMessage": "The setting `json.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`."
"json.colorDecorators.enable.deprecationMessage": "The setting `json.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.",
"json.experimental.syntaxFolding": "Enables/disables syntax aware folding markers."
}

View file

@ -11,7 +11,7 @@
"jsonc-parser": "^1.0.1",
"request-light": "^0.2.2",
"vscode-json-languageservice": "^3.0.7",
"vscode-languageserver": "^4.0.0-next.3",
"vscode-languageserver": "4.0.0-next.3",
"vscode-nls": "^3.2.1",
"vscode-uri": "^1.0.1"
},

View file

@ -20,6 +20,9 @@ import Strings = require('./utils/strings');
import { formatError, runSafe, runSafeAsync } from './utils/errors';
import { JSONDocument, JSONSchema, getLanguageService, DocumentLanguageSettings, SchemaConfiguration } from 'vscode-json-languageservice';
import { getLanguageModelCache } from './languageModelCache';
import { createScanner, SyntaxKind } from 'jsonc-parser';
import { FoldingRangeType, FoldingRangesRequest, FoldingRange, FoldingRangeList, FoldingProviderServerCapabilities } from './protocol/foldingProvider.proposed';
interface ISchemaAssociations {
[pattern: string]: string[];
@ -71,14 +74,15 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
clientSnippetSupport = hasClientCapability('textDocument', 'completion', 'completionItem', 'snippetSupport');
clientDynamicRegisterSupport = hasClientCapability('workspace', 'symbol', 'dynamicRegistration');
let capabilities: ServerCapabilities & CPServerCapabilities = {
let capabilities: ServerCapabilities & CPServerCapabilities & FoldingProviderServerCapabilities = {
// Tell the client that the server works in FULL text document sync mode
textDocumentSync: documents.syncKind,
completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: ['"', ':'] } : void 0,
hoverProvider: true,
documentSymbolProvider: true,
documentRangeFormattingProvider: false,
colorProvider: true
colorProvider: true,
foldingProvider: true
};
return { capabilities };
@ -347,7 +351,86 @@ connection.onRequest(ColorPresentationRequest.type, params => {
return languageService.getColorPresentations(document, jsonDocument, params.color, params.range);
}
return [];
}, [], `Error while computing color presentationsd for ${params.textDocument.uri}`);
}, [], `Error while computing color presentations for ${params.textDocument.uri}`);
});
connection.onRequest(FoldingRangesRequest.type, params => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
if (document) {
let ranges: FoldingRange[] = [];
let stack: FoldingRange[] = [];
let prevStart = -1;
let scanner = createScanner(document.getText(), false);
let token = scanner.scan();
while (token !== SyntaxKind.EOF) {
switch (token) {
case SyntaxKind.OpenBraceToken:
case SyntaxKind.OpenBracketToken: {
let startLine = document.positionAt(scanner.getTokenOffset()).line;
let range = { startLine, endLine: startLine, type: token === SyntaxKind.OpenBraceToken ? 'object' : 'array' };
stack.push(range);
break;
}
case SyntaxKind.CloseBraceToken:
case SyntaxKind.CloseBracketToken: {
let type = token === SyntaxKind.CloseBraceToken ? 'object' : 'array';
if (stack.length > 0 && stack[stack.length - 1].type === type) {
let range = stack.pop();
let line = document.positionAt(scanner.getTokenOffset()).line;
if (range && line > range.startLine + 1 && prevStart !== range.startLine) {
range.endLine = line - 1;
ranges.push(range);
prevStart = range.startLine;
}
}
break;
}
case SyntaxKind.BlockCommentTrivia: {
let startLine = document.positionAt(scanner.getTokenOffset()).line;
let endLine = document.positionAt(scanner.getTokenOffset() + scanner.getTokenLength()).line;
if (startLine < endLine) {
ranges.push({ startLine, endLine, type: FoldingRangeType.Comment });
prevStart = startLine;
}
break;
}
case SyntaxKind.LineCommentTrivia: {
let text = document.getText().substr(scanner.getTokenOffset(), scanner.getTokenLength());
let m = text.match(/^\/\/\s*#(region\b)|(endregion\b)/);
if (m) {
let line = document.positionAt(scanner.getTokenOffset()).line;
if (m[1]) { // start pattern match
let range = { startLine: line, endLine: line, type: FoldingRangeType.Region };
stack.push(range);
} else {
let i = stack.length - 1;
while (i >= 0 && stack[i].type !== FoldingRangeType.Region) {
i--;
}
if (i >= 0) {
let range = stack[i];
stack.length = i;
if (line > range.startLine && prevStart !== range.startLine) {
range.endLine = line;
ranges.push(range);
prevStart = range.startLine;
}
}
}
}
break;
}
}
token = scanner.scan();
}
return <FoldingRangeList>{ ranges };
}
return null;
}, null, `Error while computing folding ranges for ${params.textDocument.uri}`);
});
// Listen on the connection

View file

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { TextDocumentIdentifier } from 'vscode-languageserver-types';
import { RequestType, TextDocumentRegistrationOptions, StaticRegistrationOptions } from 'vscode-languageserver-protocol';
// ---- capabilities
export interface FoldingProviderClientCapabilities {
/**
* The text document client capabilities
*/
textDocument?: {
/**
* Capabilities specific to the foldingProvider
*/
foldingProvider?: {
/**
* Whether implementation supports dynamic registration. If this is set to `true`
* the client supports the new `(FoldingProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
* return value for the corresponding server capability as well.
*/
dynamicRegistration?: boolean;
};
};
}
export interface FoldingProviderOptions {
}
export interface FoldingProviderServerCapabilities {
/**
* The server provides folding provider support.
*/
foldingProvider?: FoldingProviderOptions | (FoldingProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions);
}
export interface FoldingRangeList {
/**
* The folding ranges.
*/
ranges: FoldingRange[];
}
export enum FoldingRangeType {
/**
* Folding range for a comment
*/
Comment = 'comment',
/**
* Folding range for a imports or includes
*/
Imports = 'imports',
/**
* Folding range for a region (e.g. `#region`)
*/
Region = 'region'
}
export interface FoldingRange {
/**
* The start line number
*/
startLine: number;
/**
* The end line number
*/
endLine: number;
/**
* The actual color value for this folding range.
*/
type?: FoldingRangeType | string;
}
export interface FoldingRangeRequestParam {
/**
* The text document.
*/
textDocument: TextDocumentIdentifier;
}
export namespace FoldingRangesRequest {
export const type: RequestType<FoldingRangeRequestParam, FoldingRangeList | null, any, any> = new RequestType('textDocument/foldingRanges');
}

View file

@ -88,7 +88,7 @@ vscode-languageserver-types@^3.6.0-next.1:
version "3.6.0-next.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.0-next.1.tgz#98e488d3f87b666b4ee1a3d89f0023e246d358f3"
vscode-languageserver@^4.0.0-next.3:
vscode-languageserver@4.0.0-next.3:
version "4.0.0-next.3"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.0.0-next.3.tgz#89a9ce5078e3a86a78e3551c3766194ce4295611"
dependencies:

View file

@ -28,9 +28,9 @@ semver@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
vscode-extension-telemetry@0.0.13:
version "0.0.13"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.13.tgz#8a4438cbb0a9f9f8ad65479e4ec08683aa4de0f7"
vscode-extension-telemetry@0.0.14:
version "0.0.14"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.14.tgz#17454705b6bb8757351b955d812923f02ee895bf"
dependencies:
applicationinsights "1.0.1"
@ -38,7 +38,7 @@ vscode-jsonrpc@^3.6.0-next.1:
version "3.6.0-next.1"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0-next.1.tgz#3cb463dffe5842d6aec16718ca9252708cd6aabe"
vscode-languageclient@^4.0.0-next.9:
vscode-languageclient@4.0.0-next.9:
version "4.0.0-next.9"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.0.0-next.9.tgz#2a06568f46ee9de3490f85e227d3740a21a03d3a"
dependencies:

View file

@ -24,11 +24,6 @@
}
],
"grammars": [
{
"language": "Log",
"scopeName": "text.log",
"path": "./syntaxes/log.tmLanguage.json"
},
{
"language": "log",
"scopeName": "text.log",

View file

@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/emilast/vscode-logfile-highlighter/commit/8196aa2cc8dd9b1eda431203857e5317866facec",
"version": "https://github.com/emilast/vscode-logfile-highlighter/commit/73d0058c4712dc93bb4f8f6ca3629d421da0651d",
"name": "Log file",
"scopeName": "text.log",
"patterns": [
@ -86,11 +86,11 @@
"name": "constant.language log.constant"
},
{
"match": "(([A-Za-z]\\:(\\\\|/))|(\\.(\\\\|/))|(\\.\\.(\\\\|/)){1,}|(\\\\\\\\|//)[\\w -]+(\\\\|/))([\\w -]+(\\\\|/))*",
"match": "(([a-zA-Z]\\:)|(\\.\\.)|(\\.))?((/|\\\\)[\\w\\-\\.]*)",
"name": "constant.language log.constant"
},
{
"match": "\\b([\\w]+\\.)+(\\w)+\\b",
"match": "\\b([\\w-]+\\.)+([\\w-])+\\b",
"name": "constant.language log.constant"
}
]

View file

@ -27,10 +27,9 @@
if (!unloadedStyles.length) {
return;
}
const args = [unloadedStyles];
window.parent.postMessage({
command: 'did-click-link',
data: `command:_markdown.onPreviewStyleLoadError?${encodeURIComponent(JSON.stringify(args))}`
command: '_markdown.onPreviewStyleLoadError',
args: [unloadedStyles]
}, '*');
});
}());

View file

@ -1,11 +1,11 @@
{
"name": "vscode-markdown",
"displayName": "VS Code Markdown",
"description": "Markdown for VS Code",
"enableProposedApi": true,
"displayName": "%displayName%",
"description": "%description%",
"version": "0.2.0",
"publisher": "Microsoft",
"publisher": "vscode",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
"enableProposedApi": true,
"engines": {
"vscode": "^1.20.0"
},
@ -314,7 +314,7 @@
"highlight.js": "9.5.0",
"markdown-it": "^8.4.0",
"markdown-it-named-headers": "0.0.4",
"vscode-extension-telemetry": "^0.0.13",
"vscode-extension-telemetry": "^0.0.14",
"vscode-nls": "^3.2.1"
},
"devDependencies": {

View file

@ -1,4 +1,6 @@
{
"displayName": "Markdown Language Features",
"description": "Provides rich language support for Markdown.",
"markdown.preview.breaks.desc": "Sets how line-breaks are rendered in the markdown preview. Setting it to 'true' creates a <br> for every newline.",
"markdown.preview.linkify": "Enable or disable conversion of URL-like text to links in the markdown preview.",
"markdown.preview.doubleClickToSwitchToEditor.desc": "Double click in the markdown preview to switch to the editor.",

View file

@ -354,7 +354,10 @@ export class MarkdownPreviewWebviewManager {
const view = vscode.window.createWebview(
localize('previewTitle', 'Preview {0}', path.basename(resource.fsPath)),
viewColumn,
{ enableScripts: true });
{
enableScripts: true,
localResourceRoots: this.getLocalResourceRoots(resource)
});
this.contentProvider.provideTextDocumentContent(resource, this.previewConfigurations).then(x => view.html = x);
@ -373,4 +376,19 @@ export class MarkdownPreviewWebviewManager {
this.webviews.set(resource.fsPath, view);
return view;
}
private getLocalResourceRoots(
resource: vscode.Uri
): vscode.Uri[] {
const folder = vscode.workspace.getWorkspaceFolder(resource);
if (folder) {
return [folder.uri];
}
if (!resource.scheme || resource.scheme === 'file') {
return [vscode.Uri.parse(path.dirname(resource.fsPath))];
}
return [];
}
}

View file

@ -1743,9 +1743,9 @@ vinyl@~2.0.1:
remove-trailing-separator "^1.0.1"
replace-ext "^1.0.0"
vscode-extension-telemetry@^0.0.13:
version "0.0.13"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.13.tgz#8a4438cbb0a9f9f8ad65479e4ec08683aa4de0f7"
vscode-extension-telemetry@^0.0.14:
version "0.0.14"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.14.tgz#17454705b6bb8757351b955d812923f02ee895bf"
dependencies:
applicationinsights "1.0.1"

View file

@ -0,0 +1,3 @@
# Merge Conflict
**Notice** This is a an extension that is bundled with Visual Studio Code.

View file

@ -1,8 +1,9 @@
{
"name": "merge-conflict",
"publisher": "vscode",
"displayName": "merge-conflict",
"description": "Merge Conflict",
"displayName": "%displayName%",
"description": "%description%",
"icon": "resources/icons/merge-conflict.png",
"version": "0.7.0",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
"engines": {
@ -99,7 +100,6 @@
}
},
"dependencies": {
"vscode-extension-telemetry": "0.0.13",
"vscode-nls": "^3.2.1"
},
"devDependencies": {

View file

@ -1,4 +1,6 @@
{
"displayName": "Merge Conflict",
"description": "Coloring and commands for inline merge conflicts.",
"command.category": "Merge Conflict",
"command.accept.all-current": "Accept All Current",
"command.accept.all-incoming": "Accept All Incoming",

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -6,38 +6,6 @@
version "8.0.33"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.33.tgz#1126e94374014e54478092830704f6ea89df04cd"
applicationinsights@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/applicationinsights/-/applicationinsights-1.0.1.tgz#53446b830fe8d5d619eee2a278b31d3d25030927"
dependencies:
diagnostic-channel "0.2.0"
diagnostic-channel-publishers "0.2.1"
zone.js "0.7.6"
diagnostic-channel-publishers@0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/diagnostic-channel-publishers/-/diagnostic-channel-publishers-0.2.1.tgz#8e2d607a8b6d79fe880b548bc58cc6beb288c4f3"
diagnostic-channel@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/diagnostic-channel/-/diagnostic-channel-0.2.0.tgz#cc99af9612c23fb1fff13612c72f2cbfaa8d5a17"
dependencies:
semver "^5.3.0"
semver@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
vscode-extension-telemetry@0.0.13:
version "0.0.13"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.13.tgz#8a4438cbb0a9f9f8ad65479e4ec08683aa4de0f7"
dependencies:
applicationinsights "1.0.1"
vscode-nls@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.1.tgz#b1f3e04e8a94a715d5a7bcbc8339c51e6d74ca51"
zone.js@0.7.6:
version "0.7.6"
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.7.6.tgz#fbbc39d3e0261d0986f1ba06306eb3aeb0d22009"

View file

@ -2,7 +2,7 @@
"name": "npm",
"publisher": "vscode",
"displayName": "%displayName%",
"description": "%description%",
"description": "%description%",
"version": "0.0.1",
"engines": {
"vscode": "0.10.x"
@ -16,6 +16,8 @@
"watch": "gulp watch-extension:npm"
},
"dependencies": {
"jsonc-parser": "^1.0.0",
"request-light": "^0.2.2",
"vscode-nls": "^3.2.1"
},
"devDependencies": {
@ -23,7 +25,8 @@
},
"main": "./out/main",
"activationEvents": [
"onCommand:workbench.action.tasks.runTask"
"onCommand:workbench.action.tasks.runTask",
"onLanguage:json"
],
"contributes": {
"configuration": {
@ -59,6 +62,16 @@
}
}
},
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "https://schemastore.azurewebsites.net/schemas/json/package.json"
},
{
"fileMatch": "bower.json",
"url": "https://schemastore.azurewebsites.net/schemas/json/bower.json"
}
],
"taskDefinitions": [
{
"type": "npm",

View file

@ -2,19 +2,21 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//tslint:disable
'use strict';
import * as path from 'path';
import * as fs from 'fs';
import * as httpRequest from 'request-light';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { addJSONProviders } from './features/jsonContributions';
type AutoDetect = 'on' | 'off';
let taskProvider: vscode.Disposable | undefined;
export function activate(_context: vscode.ExtensionContext): void {
export function activate(context: vscode.ExtensionContext): void {
if (!vscode.workspace.workspaceFolders) {
return;
}
@ -27,6 +29,15 @@ export function activate(_context: vscode.ExtensionContext): void {
return undefined;
}
});
configureHttpRequest();
vscode.workspace.onDidChangeConfiguration(() => configureHttpRequest());
context.subscriptions.push(addJSONProviders(httpRequest.xhr));
}
function configureHttpRequest() {
const httpSettings = vscode.workspace.getConfiguration('http');
httpRequest.configure(httpSettings.get<string>('proxy', ''), httpSettings.get<boolean>('proxyStrictSSL', true));
}
export function deactivate(): void {

View file

@ -6,6 +6,68 @@
version "7.0.43"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.43.tgz#a187e08495a075f200ca946079c914e1a5fe962c"
agent-base@4, agent-base@^4.1.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.0.tgz#9838b5c3392b962bad031e6a4c5e1024abec45ce"
dependencies:
es6-promisify "^5.0.0"
debug@2:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
dependencies:
ms "2.0.0"
debug@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
dependencies:
ms "2.0.0"
es6-promise@^4.0.3:
version "4.2.4"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.4.tgz#dc4221c2b16518760bd8c39a52d8f356fc00ed29"
es6-promisify@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
dependencies:
es6-promise "^4.0.3"
http-proxy-agent@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.0.0.tgz#46482a2f0523a4d6082551709f469cb3e4a85ff4"
dependencies:
agent-base "4"
debug "2"
https-proxy-agent@2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.1.1.tgz#a7ce4382a1ba8266ee848578778122d491260fd9"
dependencies:
agent-base "^4.1.0"
debug "^3.1.0"
jsonc-parser@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-1.0.1.tgz#7f8f296414e6e7c4a33b9e4914fc8c47e4421675"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
request-light@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/request-light/-/request-light-0.2.2.tgz#53e48af32ad1514e45221ea5ece5ce782720f712"
dependencies:
http-proxy-agent "2.0.0"
https-proxy-agent "2.1.1"
vscode-nls "^2.0.2"
vscode-nls@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-2.0.2.tgz#808522380844b8ad153499af5c3b03921aea02da"
vscode-nls@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.1.tgz#b1f3e04e8a94a715d5a7bcbc8339c51e6d74ca51"

View file

@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "Dependencies shared by all extensions",
"dependencies": {
"typescript": "2.7.1"
"typescript": "2.7.2"
},
"scripts": {
"postinstall": "node ./postinstall"

View file

@ -312,6 +312,7 @@
"editorHoverWidget.background": "#000c38",
"editorHoverWidget.border": "#004c18",
"editorLineNumber.foreground": "#406385",
"editorActiveLineNumber.foreground": "#80a2c2",
"editorMarkerNavigation.background": "#060621",
"editorMarkerNavigationError.background": "#AB395B",
"editorMarkerNavigationWarning.background": "#5B7E7A",

View file

@ -20,6 +20,7 @@
"editorHoverWidget.background": "#221a14",
"editorGroupHeader.tabsBackground": "#131510",
"editorGroup.background": "#0f0c08",
"editorActiveLineNumber.foreground": "#adadad",
"tab.inactiveBackground": "#131510",
"titleBar.activeBackground": "#423523",
"statusBar.background": "#423523",

View file

@ -13,6 +13,7 @@
"editor.selectionBackground": "#676b7180",
"editor.selectionHighlightBackground": "#575b6180",
"editor.lineHighlightBackground": "#303030",
"editorActiveLineNumber.foreground": "#949494",
"editor.wordHighlightBackground": "#4747a180",
"editor.wordHighlightStrongBackground": "#6767ce80",
"editorCursor.foreground": "#c07020",

View file

@ -24,6 +24,7 @@
"editor.wordHighlightBackground": "#4a4a7680",
"editor.wordHighlightStrongBackground": "#6a6a9680",
"editor.lineHighlightBackground": "#3e3d32",
"editorActiveLineNumber.foreground": "#c2c2bf",
"editorCursor.foreground": "#f8f8f0",
"editorWhitespace.foreground": "#464741",
"editorIndentGuide.background": "#464741",

View file

@ -494,6 +494,7 @@
"editor.background": "#F5F5F5",
"editorWhitespace.foreground": "#AAAAAA",
"editor.lineHighlightBackground": "#E4F6D4",
"editorActiveLineNumber.foreground": "#9769dc",
"editor.selectionBackground": "#C9D0D9",
"panel.background": "#F5F5F5",
"sideBar.background": "#F2F2F2",

View file

@ -21,6 +21,7 @@
"editorWhitespace.foreground": "#c10000",
"editor.selectionBackground": "#750000",
"editorLineNumber.foreground": "#ff777788",
"editorActiveLineNumber.foreground": "#ffbbbb88",
"editorWidget.background": "#300000",
"editorHoverWidget.background": "#300000",
"editorSuggestWidget.background": "#300000",

View file

@ -355,6 +355,7 @@
"editorCursor.foreground": "#D30102",
"editorWhitespace.foreground": "#93A1A180",
"editor.lineHighlightBackground": "#073642",
"editorActiveLineNumber.foreground": "#949494",
"editor.selectionBackground": "#073642",
// "editorIndentGuide.background": "",
"editorHoverWidget.background": "#004052",

View file

@ -354,6 +354,7 @@
"editor.selectionBackground": "#EEE8D5",
// "editorIndentGuide.background": "",
"editorHoverWidget.background": "#CCC4B0",
"editorActiveLineNumber.foreground": "#567983",
// "editorHoverWidget.border": "",
// "editorLineNumber.foreground": "",
// "editorMarkerNavigation.background": "",

View file

@ -14,7 +14,8 @@
"editor.background": "#002451",
"editor.foreground": "#ffffff",
"editor.selectionBackground": "#003f8e",
"editor.lineHighlightBackground": "#00346e",
"editor.lineHighlightBackground": "#00346e",
"editorActiveLineNumber.foreground": "#949494",
"editorCursor.foreground": "#ffffff",
"editorWhitespace.foreground": "#404f7d",
"editorWidget.background": "#001c40",

View file

@ -0,0 +1,4 @@
build/**
src/**
test/**
tsconfig.json

View file

@ -0,0 +1,7 @@
[{
"name": "TypeScript-TmLanguage",
"version": "0.1.8",
"license": "MIT",
"repositoryURL": "https://github.com/Microsoft/TypeScript-TmLanguage",
"description": "The files syntaxes/TypeScript.tmLanguage.json and syntaxes/TypeScriptReact.tmLanguage.json were derived from TypeScript.tmLanguage and TypeScriptReact.tmLanguage in https://github.com/Microsoft/TypeScript-TmLanguage."
}]

View file

@ -0,0 +1,34 @@
{
"comments": {
"lineComment": "//",
"blockComment": [ "/*", "*/" ]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "\"", "close": "\"", "notIn": ["string"] },
{ "open": "`", "close": "`", "notIn": ["string", "comment"] },
{ "open": "/**", "close": " */", "notIn": ["string"] }
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["'", "'"],
["\"", "\""],
["`", "`"]
],
"folding": {
"markers": {
"start": "^\\s*//\\s*#?region\\b",
"end": "^\\s*//\\s*#?endregion\\b"
}
}
}

View file

@ -0,0 +1,60 @@
{
"name": "typescript-basics",
"description": "%description%",
"displayName": "%displayName%",
"version": "0.10.1",
"author": "vscode",
"publisher": "vscode",
"license": "MIT",
"engines": {
"vscode": "*"
},
"scripts": {
"update-grammar": "node ./build/update-grammars.js"
},
"contributes": {
"languages": [
{
"id": "typescript",
"aliases": [
"TypeScript",
"ts",
"typescript"
],
"extensions": [
".ts"
],
"configuration": "./language-configuration.json"
},
{
"id": "typescriptreact",
"aliases": [
"TypeScript React",
"tsx"
],
"extensions": [
".tsx"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "typescript",
"scopeName": "source.ts",
"path": "./syntaxes/TypeScript.tmLanguage.json"
},
{
"language": "typescriptreact",
"scopeName": "source.tsx",
"path": "./syntaxes/TypeScriptReact.tmLanguage.json",
"embeddedLanguages": {
"meta.tag.tsx": "jsx-tags",
"meta.tag.without-attributes.tsx": "jsx-tags",
"meta.tag.attributes.tsx": "typescriptreact",
"meta.embedded.expression.tsx": "typescriptreact"
}
}
]
}
}

View file

@ -0,0 +1,4 @@
{
"displayName": "TypeScript Language Basics",
"description": "Provides syntax highlighting and basic language support for TypeScript."
}

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