mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-13 15:35:20 +01:00
Merge branch 'master' into joh/callh
This commit is contained in:
Vendored
+11
-9
@@ -194,8 +194,8 @@
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Unit Tests",
|
||||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
||||
"name": "Run Unit Tests",
|
||||
"program": "${workspaceFolder}/test/electron/index.js",
|
||||
"runtimeExecutable": "${workspaceFolder}/.build/electron/Code - OSS.app/Contents/MacOS/Electron",
|
||||
"windows": {
|
||||
"runtimeExecutable": "${workspaceFolder}/.build/electron/Code - OSS.exe"
|
||||
@@ -205,14 +205,9 @@
|
||||
},
|
||||
"outputCapture": "std",
|
||||
"args": [
|
||||
"--delay",
|
||||
"--timeout",
|
||||
"2000"
|
||||
"--remote-debugging-port=9222"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"ELECTRON_RUN_AS_NODE": "true"
|
||||
},
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/**/*.js"
|
||||
]
|
||||
@@ -269,6 +264,13 @@
|
||||
"Launch VS Code",
|
||||
"Attach to Extension Host"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Debug Unit Tests",
|
||||
"configurations": [
|
||||
"Attach to VS Code",
|
||||
"Run Unit Tests"
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,24 +2,25 @@ steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "10.15.1"
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.10.1"
|
||||
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
|
||||
inputs:
|
||||
keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
|
||||
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
|
||||
vstsFeed: '$(ArtifactFeed)'
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.10.1"
|
||||
condition: eq(variables['System.PullRequest.PullRequestId'], '')
|
||||
- script: |
|
||||
yarn
|
||||
displayName: Install Dependencies
|
||||
condition: ne(variables['CacheRestored'], 'true')
|
||||
condition: or(ne(variables['System.PullRequest.PullRequestId'], ''), ne(variables['CacheRestored'], 'true'))
|
||||
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
|
||||
inputs:
|
||||
keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
|
||||
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
|
||||
vstsFeed: '$(ArtifactFeed)'
|
||||
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
||||
condition: and(succeeded(), eq(variables['System.PullRequest.PullRequestId'], ''), ne(variables['CacheRestored'], 'true'))
|
||||
- script: |
|
||||
yarn gulp electron-x64
|
||||
displayName: Download Electron
|
||||
|
||||
@@ -10,24 +10,25 @@ steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "10.15.1"
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.10.1"
|
||||
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
|
||||
inputs:
|
||||
keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
|
||||
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
|
||||
vstsFeed: '$(ArtifactFeed)'
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.10.1"
|
||||
condition: eq(variables['System.PullRequest.PullRequestId'], '')
|
||||
- script: |
|
||||
yarn
|
||||
displayName: Install Dependencies
|
||||
condition: ne(variables['CacheRestored'], 'true')
|
||||
condition: or(ne(variables['System.PullRequest.PullRequestId'], ''), ne(variables['CacheRestored'], 'true'))
|
||||
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
|
||||
inputs:
|
||||
keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
|
||||
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
|
||||
vstsFeed: '$(ArtifactFeed)'
|
||||
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
||||
condition: and(succeeded(), eq(variables['System.PullRequest.PullRequestId'], ''), ne(variables['CacheRestored'], 'true'))
|
||||
- script: |
|
||||
yarn gulp electron-x64
|
||||
displayName: Download Electron
|
||||
|
||||
@@ -14,16 +14,17 @@ steps:
|
||||
keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
|
||||
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
|
||||
vstsFeed: '$(ArtifactFeed)'
|
||||
condition: eq(variables['System.PullRequest.PullRequestId'], '')
|
||||
- powershell: |
|
||||
yarn
|
||||
displayName: Install Dependencies
|
||||
condition: ne(variables['CacheRestored'], 'true')
|
||||
condition: or(ne(variables['System.PullRequest.PullRequestId'], ''), ne(variables['CacheRestored'], 'true'))
|
||||
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
|
||||
inputs:
|
||||
keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
|
||||
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
|
||||
vstsFeed: '$(ArtifactFeed)'
|
||||
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
||||
condition: and(succeeded(), eq(variables['System.PullRequest.PullRequestId'], ''), ne(variables['CacheRestored'], 'true'))
|
||||
- powershell: |
|
||||
yarn gulp electron
|
||||
displayName: Download Electron
|
||||
|
||||
@@ -42,7 +42,7 @@ function prepareDebPackage(arch) {
|
||||
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
||||
.pipe(replace('@@NAME_SHORT@@', product.nameShort))
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(replace('@@ICON@@', product.applicationName))
|
||||
.pipe(replace('@@ICON@@', product.linuxIconName))
|
||||
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));
|
||||
|
||||
const appdata = gulp.src('resources/linux/code.appdata.xml', { base: '.' })
|
||||
@@ -52,7 +52,7 @@ function prepareDebPackage(arch) {
|
||||
.pipe(rename('usr/share/appdata/' + product.applicationName + '.appdata.xml'));
|
||||
|
||||
const icon = gulp.src('resources/linux/code.png', { base: '.' })
|
||||
.pipe(rename('usr/share/pixmaps/' + product.applicationName + '.png'));
|
||||
.pipe(rename('usr/share/pixmaps/' + product.linuxIconName + '.png'));
|
||||
|
||||
// const bash_completion = gulp.src('resources/completions/bash/code')
|
||||
// .pipe(rename('usr/share/bash-completion/completions/code'));
|
||||
@@ -132,7 +132,7 @@ function prepareRpmPackage(arch) {
|
||||
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
||||
.pipe(replace('@@NAME_SHORT@@', product.nameShort))
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(replace('@@ICON@@', product.applicationName))
|
||||
.pipe(replace('@@ICON@@', product.linuxIconName))
|
||||
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));
|
||||
|
||||
const appdata = gulp.src('resources/linux/code.appdata.xml', { base: '.' })
|
||||
@@ -142,7 +142,7 @@ function prepareRpmPackage(arch) {
|
||||
.pipe(rename('usr/share/appdata/' + product.applicationName + '.appdata.xml'));
|
||||
|
||||
const icon = gulp.src('resources/linux/code.png', { base: '.' })
|
||||
.pipe(rename('BUILD/usr/share/pixmaps/' + product.applicationName + '.png'));
|
||||
.pipe(rename('BUILD/usr/share/pixmaps/' + product.linuxIconName + '.png'));
|
||||
|
||||
// const bash_completion = gulp.src('resources/completions/bash/code')
|
||||
// .pipe(rename('BUILD/usr/share/bash-completion/completions/code'));
|
||||
@@ -156,6 +156,7 @@ function prepareRpmPackage(arch) {
|
||||
const spec = gulp.src('resources/linux/rpm/code.spec.template', { base: '.' })
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
||||
.pipe(replace('@@ICON@@', product.linuxIconName))
|
||||
.pipe(replace('@@VERSION@@', packageJson.version))
|
||||
.pipe(replace('@@RELEASE@@', linuxPackageRevision))
|
||||
.pipe(replace('@@ARCHITECTURE@@', rpmArch))
|
||||
@@ -202,11 +203,11 @@ function prepareSnapPackage(arch) {
|
||||
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
||||
.pipe(replace('@@NAME_SHORT@@', product.nameShort))
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(replace('@@ICON@@', `/usr/share/pixmaps/${product.applicationName}.png`))
|
||||
.pipe(replace('@@ICON@@', `/usr/share/pixmaps/${product.linuxIconName}.png`))
|
||||
.pipe(rename(`usr/share/applications/${product.applicationName}.desktop`));
|
||||
|
||||
const icon = gulp.src('resources/linux/code.png', { base: '.' })
|
||||
.pipe(rename(`usr/share/pixmaps/${product.applicationName}.png`));
|
||||
.pipe(rename(`usr/share/pixmaps/${product.linuxIconName}.png`));
|
||||
|
||||
const code = gulp.src(binaryDir + '/**/*', { base: binaryDir })
|
||||
.pipe(rename(function (p) { p.dirname = `usr/share/${product.applicationName}/${p.dirname}`; }));
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"contributes": {
|
||||
"languages": [{
|
||||
"id": "coffeescript",
|
||||
"extensions": [ ".coffee", ".cson" ],
|
||||
"extensions": [ ".coffee", ".cson", ".iced" ],
|
||||
"aliases": [ "CoffeeScript", "coffeescript", "coffee" ],
|
||||
"configuration": "./language-configuration.json"
|
||||
}],
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"main": "./out/cssServerMain",
|
||||
"dependencies": {
|
||||
"vscode-css-languageservice": "^4.0.0-next.3",
|
||||
"vscode-css-languageservice": "^4.0.0-next.5",
|
||||
"vscode-languageserver": "^5.3.0-next.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -229,10 +229,10 @@ supports-color@5.4.0:
|
||||
dependencies:
|
||||
has-flag "^3.0.0"
|
||||
|
||||
vscode-css-languageservice@^4.0.0-next.3:
|
||||
version "4.0.0-next.3"
|
||||
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.0-next.3.tgz#e9529f3b4ddf95c9a3e5dc2a6d701a38280ffa98"
|
||||
integrity sha512-/xmbWpIQLw+HZ/3LsaE2drHFSNJbM9mZ8bKR5NUiu2ZUr10WbGxX0j/GDZB3LlMmdSHQGgRQ5hTM/Ic2PuBDRw==
|
||||
vscode-css-languageservice@^4.0.0-next.5:
|
||||
version "4.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.0-next.5.tgz#a9246d3c85c33e2878b305a93de6a2c7fef53d3b"
|
||||
integrity sha512-ZO8mfoZjPgY+T77+frQHtlXPxt00ogPJfdOY2T8I3vT+1m32GIUKjcmgwg4sMtx3/+PYwu2SowgygrStny9JvQ==
|
||||
dependencies:
|
||||
vscode-languageserver-types "^3.14.0"
|
||||
vscode-nls "^4.0.0"
|
||||
|
||||
@@ -119,7 +119,7 @@ class ServerReadyDetector extends vscode.Disposable {
|
||||
request: 'launch',
|
||||
url: uri,
|
||||
webRoot: args.webRoot || WEB_ROOT
|
||||
});
|
||||
}, session);
|
||||
break;
|
||||
default:
|
||||
// not supported
|
||||
|
||||
@@ -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/Microsoft/TypeScript-TmLanguage/commit/06d49b5ea993412a21aad630a17c6e7e7081c30f",
|
||||
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/17761d144b2bd62ffc9ad61eddcd10ec307a7bbc",
|
||||
"name": "JavaScript (with React support)",
|
||||
"scopeName": "source.js",
|
||||
"patterns": [
|
||||
@@ -1618,9 +1618,12 @@
|
||||
},
|
||||
"class-expression": {
|
||||
"name": "meta.class.js",
|
||||
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(class)\\b(?=\\s+|[<{]|\\/[\\/*])",
|
||||
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(abstract)\\s+)?(class)\\b(?=\\s+|[<{]|\\/[\\/*])",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.modifier.js"
|
||||
},
|
||||
"2": {
|
||||
"name": "storage.type.class.js"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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/Microsoft/TypeScript-TmLanguage/commit/06d49b5ea993412a21aad630a17c6e7e7081c30f",
|
||||
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/17761d144b2bd62ffc9ad61eddcd10ec307a7bbc",
|
||||
"name": "JavaScript (with React support)",
|
||||
"scopeName": "source.js.jsx",
|
||||
"patterns": [
|
||||
@@ -1618,9 +1618,12 @@
|
||||
},
|
||||
"class-expression": {
|
||||
"name": "meta.class.js.jsx",
|
||||
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(class)\\b(?=\\s+|[<{]|\\/[\\/*])",
|
||||
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(abstract)\\s+)?(class)\\b(?=\\s+|[<{]|\\/[\\/*])",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.modifier.js.jsx"
|
||||
},
|
||||
"2": {
|
||||
"name": "storage.type.class.js.jsx"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"git": {
|
||||
"name": "TypeScript-TmLanguage",
|
||||
"repositoryUrl": "https://github.com/Microsoft/TypeScript-TmLanguage",
|
||||
"commitHash": "06d49b5ea993412a21aad630a17c6e7e7081c30f"
|
||||
"commitHash": "17761d144b2bd62ffc9ad61eddcd10ec307a7bbc"
|
||||
}
|
||||
},
|
||||
"license": "MIT",
|
||||
|
||||
@@ -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/Microsoft/TypeScript-TmLanguage/commit/06d49b5ea993412a21aad630a17c6e7e7081c30f",
|
||||
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/17761d144b2bd62ffc9ad61eddcd10ec307a7bbc",
|
||||
"name": "TypeScript",
|
||||
"scopeName": "source.ts",
|
||||
"patterns": [
|
||||
@@ -1615,9 +1615,12 @@
|
||||
},
|
||||
"class-expression": {
|
||||
"name": "meta.class.ts",
|
||||
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(class)\\b(?=\\s+|[<{]|\\/[\\/*])",
|
||||
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(abstract)\\s+)?(class)\\b(?=\\s+|[<{]|\\/[\\/*])",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.modifier.ts"
|
||||
},
|
||||
"2": {
|
||||
"name": "storage.type.class.ts"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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/Microsoft/TypeScript-TmLanguage/commit/06d49b5ea993412a21aad630a17c6e7e7081c30f",
|
||||
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/17761d144b2bd62ffc9ad61eddcd10ec307a7bbc",
|
||||
"name": "TypeScriptReact",
|
||||
"scopeName": "source.tsx",
|
||||
"patterns": [
|
||||
@@ -1618,9 +1618,12 @@
|
||||
},
|
||||
"class-expression": {
|
||||
"name": "meta.class.tsx",
|
||||
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(class)\\b(?=\\s+|[<{]|\\/[\\/*])",
|
||||
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(abstract)\\s+)?(class)\\b(?=\\s+|[<{]|\\/[\\/*])",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.modifier.tsx"
|
||||
},
|
||||
"2": {
|
||||
"name": "storage.type.class.tsx"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -705,7 +705,7 @@
|
||||
"problemPatterns": [
|
||||
{
|
||||
"name": "tsc",
|
||||
"regexp": "^([^\\s].*)[\\(:](\\d+)[,:](\\d+)(?:\\):\\s+|\\s+-\\s+)(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$",
|
||||
"regexp": "^([^\\s].*)[\\(:](\\d+)[,:](\\d+)(?:\\):\\s+|\\s+-\\s+)(error|warning|info)\\s+TS(\\d+)\\s*:\\s*(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
|
||||
@@ -4,15 +4,18 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as Proto from '../protocol';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import { nulToken } from '../utils/cancellation';
|
||||
import { Command, CommandManager } from '../utils/commandManager';
|
||||
import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import TelemetryReporter from '../utils/telemetry';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import FormattingOptionsManager from './fileConfigurationManager';
|
||||
import { nulToken } from '../utils/cancellation';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
||||
class ApplyRefactoringCommand implements Command {
|
||||
@@ -49,7 +52,12 @@ class ApplyRefactoringCommand implements Command {
|
||||
action,
|
||||
};
|
||||
const response = await this.client.execute('getEditsForRefactor', args, nulToken);
|
||||
if (response.type !== 'response' || !response.body || !response.body.edits.length) {
|
||||
if (response.type !== 'response' || !response.body) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!response.body.edits.length) {
|
||||
vscode.window.showErrorMessage(localize('refactoringFailed', "Could not apply refactoring"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.33.0",
|
||||
"distro": "86205a690407abb9cd51d53f9f2150f17b2ef53e",
|
||||
"distro": "3dfd693162a1a4c42af4ccd471c49c930d45785e",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"win32AppUserModelId": "Microsoft.CodeOSS",
|
||||
"win32ShellNameShort": "C&ode - OSS",
|
||||
"darwinBundleIdentifier": "com.visualstudio.code.oss",
|
||||
"linuxIconName": "com.visualstudio.code.oss",
|
||||
"reportIssueUrl": "https://github.com/Microsoft/vscode/issues/new",
|
||||
"urlProtocol": "code-oss",
|
||||
"extensionAllowedProposedApi": [
|
||||
|
||||
+6
-4
@@ -5,13 +5,15 @@
|
||||
|
||||
exports.base = [{
|
||||
name: 'vs/base/common/worker/simpleWorker',
|
||||
include: [ 'vs/editor/common/services/editorSimpleWorker' ],
|
||||
prepend: [ 'vs/loader.js' ],
|
||||
append: [ 'vs/base/worker/workerMain' ],
|
||||
include: ['vs/editor/common/services/editorSimpleWorker'],
|
||||
prepend: ['vs/loader.js'],
|
||||
append: ['vs/base/worker/workerMain'],
|
||||
dest: 'vs/base/worker/workerMain.js'
|
||||
}];
|
||||
//@ts-ignore review
|
||||
|
||||
exports.workbench = require('./vs/workbench/buildfile').collectModules(['vs/workbench/workbench.main']);
|
||||
exports.workbenchNodeless = require('./vs/workbench/buildfile').collectModules(['vs/workbench/workbench.nodeless.main']);
|
||||
|
||||
exports.code = require('./vs/code/buildfile').collectModules();
|
||||
|
||||
exports.entrypoint = function (name) {
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
"./vs/workbench/api/electron-browser/mainThreadSearch.ts",
|
||||
"./vs/workbench/api/electron-browser/mainThreadStatusBar.ts",
|
||||
"./vs/workbench/api/electron-browser/mainThreadStorage.ts",
|
||||
"./vs/workbench/api/electron-browser/mainThreadTask.ts",
|
||||
"./vs/workbench/api/electron-browser/mainThreadTelemetry.ts",
|
||||
"./vs/workbench/api/electron-browser/mainThreadTerminalService.ts",
|
||||
"./vs/workbench/api/electron-browser/mainThreadTreeViews.ts",
|
||||
@@ -95,6 +96,7 @@
|
||||
"./vs/workbench/api/node/extHostCommands.ts",
|
||||
"./vs/workbench/api/node/extHostComments.ts",
|
||||
"./vs/workbench/api/node/extHostConfiguration.ts",
|
||||
// "./vs/workbench/api/node/extHostDebugService.ts",
|
||||
"./vs/workbench/api/node/extHostDecorations.ts",
|
||||
"./vs/workbench/api/node/extHostDiagnostics.ts",
|
||||
"./vs/workbench/api/node/extHostDialogs.ts",
|
||||
@@ -118,6 +120,8 @@
|
||||
"./vs/workbench/api/node/extHostSearch.ts",
|
||||
"./vs/workbench/api/node/extHostStatusBar.ts",
|
||||
"./vs/workbench/api/node/extHostStorage.ts",
|
||||
// "./vs/workbench/api/node/extHostTask.ts",
|
||||
"./vs/workbench/api/node/extHostTerminalService.ts",
|
||||
"./vs/workbench/api/node/extHostTextEditor.ts",
|
||||
"./vs/workbench/api/node/extHostTextEditors.ts",
|
||||
"./vs/workbench/api/node/extHostTypeConverters.ts",
|
||||
@@ -220,6 +224,8 @@
|
||||
"./vs/workbench/contrib/output/common/outputLinkComputer.ts",
|
||||
"./vs/workbench/contrib/output/common/outputLinkProvider.ts",
|
||||
"./vs/workbench/contrib/output/test/outputLinkProvider.test.ts",
|
||||
"./vs/workbench/contrib/preferences/browser/preferencesEditor.ts",
|
||||
"./vs/workbench/contrib/preferences/browser/preferencesRenderers.ts",
|
||||
"./vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.ts",
|
||||
"./vs/workbench/contrib/preferences/browser/keybindingWidgets.ts",
|
||||
"./vs/workbench/contrib/preferences/browser/preferencesActions.ts",
|
||||
@@ -263,7 +269,6 @@
|
||||
"./vs/workbench/contrib/search/test/common/queryBuilder.test.ts",
|
||||
"./vs/workbench/contrib/search/test/common/searchModel.test.ts",
|
||||
"./vs/workbench/contrib/search/test/common/searchResult.test.ts",
|
||||
"./vs/workbench/contrib/stats/node/stats.contribution.ts",
|
||||
"./vs/workbench/contrib/stats/node/workspaceStats.ts",
|
||||
"./vs/workbench/contrib/stats/test/workspaceStats.test.ts",
|
||||
"./vs/workbench/contrib/surveys/electron-browser/languageSurveys.contribution.ts",
|
||||
@@ -283,10 +288,10 @@
|
||||
"./vs/workbench/services/backup/node/backupFileService.ts",
|
||||
"./vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts",
|
||||
"./vs/workbench/services/broadcast/electron-browser/broadcastService.ts",
|
||||
"./vs/workbench/services/configuration/common/configurationEditingService.ts",
|
||||
"./vs/workbench/services/configuration/common/jsonEditingService.ts",
|
||||
"./vs/workbench/services/configuration/node/configuration.ts",
|
||||
"./vs/workbench/services/configuration/node/configurationEditingService.ts",
|
||||
"./vs/workbench/services/configuration/node/configurationService.ts",
|
||||
"./vs/workbench/services/configuration/node/jsonEditingService.ts",
|
||||
"./vs/workbench/services/configuration/test/common/configurationModels.test.ts",
|
||||
"./vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts",
|
||||
"./vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts",
|
||||
@@ -297,8 +302,9 @@
|
||||
"./vs/workbench/services/decorations/browser/decorations.ts",
|
||||
"./vs/workbench/services/decorations/browser/decorationsService.ts",
|
||||
"./vs/workbench/services/decorations/test/browser/decorationsService.test.ts",
|
||||
"./vs/workbench/services/dialogs/browser/remoteFileDialog.ts",
|
||||
"./vs/workbench/services/dialogs/browser/fileDialogService.ts",
|
||||
"./vs/workbench/services/dialogs/electron-browser/dialogService.ts",
|
||||
"./vs/workbench/services/dialogs/electron-browser/remoteFileDialog.ts",
|
||||
"./vs/workbench/services/editor/browser/codeEditorService.ts",
|
||||
"./vs/workbench/services/editor/browser/editorService.ts",
|
||||
"./vs/workbench/services/editor/common/editorGroupsService.ts",
|
||||
@@ -357,14 +363,16 @@
|
||||
"./vs/workbench/services/mode/common/workbenchModeService.ts",
|
||||
"./vs/workbench/services/notification/common/notificationService.ts",
|
||||
"./vs/workbench/services/panel/common/panelService.ts",
|
||||
"./vs/workbench/services/preferences/common/preferencesModels.ts",
|
||||
"./vs/workbench/services/preferences/common/keybindingsEditorModel.ts",
|
||||
"./vs/workbench/services/preferences/test/common/keybindingsEditorModel.test.ts",
|
||||
"./vs/workbench/services/progress/browser/progressService.ts",
|
||||
"./vs/workbench/services/progress/browser/progressService2.ts",
|
||||
"./vs/workbench/services/progress/test/progressService.test.ts",
|
||||
"./vs/workbench/services/remote/common/remoteAgentService.ts",
|
||||
"./vs/workbench/services/remote/common/remoteEnvironmentService.ts",
|
||||
"./vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl.ts",
|
||||
"./vs/workbench/services/remote/node/remoteAgentEnvironmentChannel.ts",
|
||||
"./vs/workbench/services/remote/node/remoteAgentService.ts",
|
||||
"./vs/workbench/services/search/common/replace.ts",
|
||||
"./vs/workbench/services/search/common/search.ts",
|
||||
"./vs/workbench/services/search/common/searchHelpers.ts",
|
||||
@@ -406,6 +414,7 @@
|
||||
"./vs/workbench/services/untitled/common/untitledEditorService.ts",
|
||||
"./vs/workbench/services/viewlet/browser/viewlet.ts",
|
||||
"./vs/workbench/services/workspace/common/workspaceEditing.ts",
|
||||
"./vs/workbench/services/configurationResolver/common/variableResolver.ts",
|
||||
"./vs/workbench/services/workspace/node/workspaceEditingService.ts",
|
||||
"./vs/workbench/test/browser/actionRegistry.test.ts",
|
||||
"./vs/workbench/test/browser/part.test.ts",
|
||||
|
||||
@@ -95,7 +95,7 @@ export class HighlightedLabel {
|
||||
let total = 0;
|
||||
let extra = 0;
|
||||
|
||||
return text.replace(/\r\n|\r|\n/, (match, offset) => {
|
||||
return text.replace(/\r\n|\r|\n/g, (match, offset) => {
|
||||
extra = match === '\r\n' ? -1 : 0;
|
||||
offset += total;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { KeyCode, ResolvedKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { Disposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
|
||||
const $ = DOM.$;
|
||||
|
||||
@@ -86,7 +87,7 @@ export class MenuBar extends Disposable {
|
||||
constructor(private container: HTMLElement, private options: IMenuBarOptions = {}) {
|
||||
super();
|
||||
|
||||
this.container.attributes['role'] = 'menubar';
|
||||
this.container.setAttribute('role', 'menubar');
|
||||
|
||||
this.menuCache = [];
|
||||
this.mnemonics = new Map<string, number>();
|
||||
@@ -857,7 +858,7 @@ export class MenuBar extends Disposable {
|
||||
getKeyBinding: this.options.getKeybinding,
|
||||
actionRunner: this.actionRunner,
|
||||
enableMnemonics: this.options.alwaysOnMnemonics || (this.mnemonicsInUse && this.options.enableMnemonics),
|
||||
ariaLabel: customMenu.buttonElement.attributes['aria-label'].value
|
||||
ariaLabel: withNullAsUndefined(customMenu.buttonElement.getAttribute('aria-label'))
|
||||
};
|
||||
|
||||
let menuWidget = this._register(new Menu(menuHolder, customMenu.actions, menuOptions));
|
||||
|
||||
@@ -218,14 +218,15 @@ export function relativePath(from: URI, to: URI): string | undefined {
|
||||
* Resolves a absolute or relative path against a base URI.
|
||||
*/
|
||||
export function resolvePath(base: URI, path: string): URI {
|
||||
let resolvedPath: string;
|
||||
if (base.scheme === Schemas.file) {
|
||||
resolvedPath = URI.file(paths.resolve(originalFSPath(base), path)).path;
|
||||
} else {
|
||||
resolvedPath = paths.posix.resolve(base.path, path);
|
||||
const newURI = URI.file(paths.resolve(originalFSPath(base), path));
|
||||
return base.with({
|
||||
authority: newURI.authority,
|
||||
path: newURI.path
|
||||
});
|
||||
}
|
||||
return base.with({
|
||||
path: resolvedPath
|
||||
path: paths.posix.resolve(base.path, path)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { readdir, stat, exists, readFile } from 'fs';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { parse, ParseError } from 'vs/base/common/json';
|
||||
|
||||
export interface WorkspaceStatItem {
|
||||
name: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export interface WorkspaceStats {
|
||||
fileTypes: WorkspaceStatItem[];
|
||||
configFiles: WorkspaceStatItem[];
|
||||
fileCount: number;
|
||||
maxFilesReached: boolean;
|
||||
launchConfigFiles: WorkspaceStatItem[];
|
||||
}
|
||||
|
||||
function asSortedItems(map: Map<string, number>): WorkspaceStatItem[] {
|
||||
const a: WorkspaceStatItem[] = [];
|
||||
map.forEach((value, index) => a.push({ name: index, count: value }));
|
||||
return a.sort((a, b) => b.count - a.count);
|
||||
}
|
||||
|
||||
export function collectLaunchConfigs(folder: string): Promise<WorkspaceStatItem[]> {
|
||||
const launchConfigs = new Map<string, number>();
|
||||
|
||||
const launchConfig = join(folder, '.vscode', 'launch.json');
|
||||
return new Promise((resolve, reject) => {
|
||||
exists(launchConfig, (doesExist) => {
|
||||
if (doesExist) {
|
||||
readFile(launchConfig, (err, contents) => {
|
||||
if (err) {
|
||||
return resolve([]);
|
||||
}
|
||||
|
||||
const errors: ParseError[] = [];
|
||||
const json = parse(contents.toString(), errors);
|
||||
if (errors.length) {
|
||||
console.log(`Unable to parse ${launchConfig}`);
|
||||
return resolve([]);
|
||||
}
|
||||
|
||||
if (json['configurations']) {
|
||||
for (const each of json['configurations']) {
|
||||
const type = each['type'];
|
||||
if (type) {
|
||||
if (launchConfigs.has(type)) {
|
||||
launchConfigs.set(type, launchConfigs.get(type)! + 1);
|
||||
} else {
|
||||
launchConfigs.set(type, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resolve(asSortedItems(launchConfigs));
|
||||
});
|
||||
} else {
|
||||
return resolve([]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export async function collectWorkspaceStats(folder: string, filter: string[]): Promise<WorkspaceStats> {
|
||||
const configFilePatterns = [
|
||||
{ 'tag': 'grunt.js', 'pattern': /^gruntfile\.js$/i },
|
||||
{ 'tag': 'gulp.js', 'pattern': /^gulpfile\.js$/i },
|
||||
{ 'tag': 'tsconfig.json', 'pattern': /^tsconfig\.json$/i },
|
||||
{ 'tag': 'package.json', 'pattern': /^package\.json$/i },
|
||||
{ 'tag': 'jsconfig.json', 'pattern': /^jsconfig\.json$/i },
|
||||
{ 'tag': 'tslint.json', 'pattern': /^tslint\.json$/i },
|
||||
{ 'tag': 'eslint.json', 'pattern': /^eslint\.json$/i },
|
||||
{ 'tag': 'tasks.json', 'pattern': /^tasks\.json$/i },
|
||||
{ 'tag': 'launch.json', 'pattern': /^launch\.json$/i },
|
||||
{ 'tag': 'settings.json', 'pattern': /^settings\.json$/i },
|
||||
{ 'tag': 'webpack.config.js', 'pattern': /^webpack\.config\.js$/i },
|
||||
{ 'tag': 'project.json', 'pattern': /^project\.json$/i },
|
||||
{ 'tag': 'makefile', 'pattern': /^makefile$/i },
|
||||
{ 'tag': 'sln', 'pattern': /^.+\.sln$/i },
|
||||
{ 'tag': 'csproj', 'pattern': /^.+\.csproj$/i },
|
||||
{ 'tag': 'cmake', 'pattern': /^.+\.cmake$/i }
|
||||
];
|
||||
|
||||
const fileTypes = new Map<string, number>();
|
||||
const configFiles = new Map<string, number>();
|
||||
|
||||
const MAX_FILES = 20000;
|
||||
|
||||
function walk(dir: string, filter: string[], token, done: (allFiles: string[]) => void): void {
|
||||
let results: string[] = [];
|
||||
readdir(dir, async (err, files) => {
|
||||
// Ignore folders that can't be read
|
||||
if (err) {
|
||||
return done(results);
|
||||
}
|
||||
|
||||
let pending = files.length;
|
||||
if (pending === 0) {
|
||||
return done(results);
|
||||
}
|
||||
|
||||
for (const file of files) {
|
||||
if (token.maxReached) {
|
||||
return done(results);
|
||||
}
|
||||
|
||||
stat(join(dir, file), (err, stats) => {
|
||||
// Ignore files that can't be read
|
||||
if (err) {
|
||||
if (--pending === 0) {
|
||||
return done(results);
|
||||
}
|
||||
} else {
|
||||
if (stats.isDirectory()) {
|
||||
if (filter.indexOf(file) === -1) {
|
||||
walk(join(dir, file), filter, token, (res: string[]) => {
|
||||
results = results.concat(res);
|
||||
|
||||
if (--pending === 0) {
|
||||
return done(results);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (--pending === 0) {
|
||||
done(results);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (token.count >= MAX_FILES) {
|
||||
token.maxReached = true;
|
||||
}
|
||||
|
||||
token.count++;
|
||||
results.push(file);
|
||||
|
||||
if (--pending === 0) {
|
||||
done(results);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const addFileType = (fileType: string) => {
|
||||
if (fileTypes.has(fileType)) {
|
||||
fileTypes.set(fileType, fileTypes.get(fileType)! + 1);
|
||||
}
|
||||
else {
|
||||
fileTypes.set(fileType, 1);
|
||||
}
|
||||
};
|
||||
|
||||
const addConfigFiles = (fileName: string) => {
|
||||
for (const each of configFilePatterns) {
|
||||
if (each.pattern.test(fileName)) {
|
||||
if (configFiles.has(each.tag)) {
|
||||
configFiles.set(each.tag, configFiles.get(each.tag)! + 1);
|
||||
} else {
|
||||
configFiles.set(each.tag, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const acceptFile = (name: string) => {
|
||||
if (name.lastIndexOf('.') >= 0) {
|
||||
const suffix: string | undefined = name.split('.').pop();
|
||||
if (suffix) {
|
||||
addFileType(suffix);
|
||||
}
|
||||
}
|
||||
addConfigFiles(name);
|
||||
};
|
||||
|
||||
const token: { count: number, maxReached: boolean } = { count: 0, maxReached: false };
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
walk(folder, filter, token, async (files) => {
|
||||
files.forEach(acceptFile);
|
||||
|
||||
const launchConfigs = await collectLaunchConfigs(folder);
|
||||
|
||||
resolve({
|
||||
configFiles: asSortedItems(configFiles),
|
||||
fileTypes: asSortedItems(fileTypes),
|
||||
fileCount: token.count,
|
||||
maxFilesReached: token.maxReached,
|
||||
launchConfigFiles: launchConfigs
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
/**
|
||||
* An `IChannel` is an abstraction over a collection of commands.
|
||||
* You can `call` several commands on a channel, each taking at
|
||||
* most one single argument. A `call` always returns a promise
|
||||
* with at most one single return value.
|
||||
*/
|
||||
export interface IChannel {
|
||||
call<T>(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T>;
|
||||
listen<T>(event: string, arg?: any): Event<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An `IServerChannel` is the couter part to `IChannel`,
|
||||
* on the server-side. You should implement this interface
|
||||
* if you'd like to handle remote promises or events.
|
||||
*/
|
||||
export interface IServerChannel<TContext = string> {
|
||||
call<T>(ctx: TContext, command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T>;
|
||||
listen<T>(ctx: TContext, event: string, arg?: any): Event<T>;
|
||||
}
|
||||
@@ -9,10 +9,11 @@ import { Delayer, createCancelablePromise } from 'vs/base/common/async';
|
||||
import { deepClone, assign } from 'vs/base/common/objects';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { createQueuedSender } from 'vs/base/node/processes';
|
||||
import { ChannelServer as IPCServer, ChannelClient as IPCClient, IChannelClient, IChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { ChannelServer as IPCServer, ChannelClient as IPCClient, IChannelClient } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { isRemoteConsoleLog, log } from 'vs/base/node/console';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
|
||||
/**
|
||||
* This implementation doesn't perform well since it uses base64 encoding for buffers.
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Event, Emitter, Relay } from 'vs/base/common/event';
|
||||
import { CancelablePromise, createCancelablePromise, timeout } from 'vs/base/common/async';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import { IServerChannel, IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
|
||||
export const enum RequestType {
|
||||
Promise = 100,
|
||||
@@ -51,27 +52,6 @@ enum State {
|
||||
Idle
|
||||
}
|
||||
|
||||
/**
|
||||
* An `IChannel` is an abstraction over a collection of commands.
|
||||
* You can `call` several commands on a channel, each taking at
|
||||
* most one single argument. A `call` always returns a promise
|
||||
* with at most one single return value.
|
||||
*/
|
||||
export interface IChannel {
|
||||
call<T>(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T>;
|
||||
listen<T>(event: string, arg?: any): Event<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An `IServerChannel` is the couter part to `IChannel`,
|
||||
* on the server-side. You should implement this interface
|
||||
* if you'd like to handle remote promises or events.
|
||||
*/
|
||||
export interface IServerChannel<TContext = string> {
|
||||
call<T>(ctx: TContext, command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T>;
|
||||
listen<T>(ctx: TContext, event: string, arg?: any): Event<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An `IChannelServer` hosts a collection of channels. You are
|
||||
* able to register channels onto it, provided a channel name.
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { IMessagePassingProtocol, IPCServer, ClientConnectionEvent, IPCClient, IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IMessagePassingProtocol, IPCServer, ClientConnectionEvent, IPCClient } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { canceled } from 'vs/base/common/errors';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
|
||||
|
||||
@@ -296,6 +296,9 @@ suite('Resources', () => {
|
||||
|
||||
assertResolve(URI.file('\\\\server\\share\\some\\'), 'b1\\file.js', URI.file('\\\\server\\share\\some\\b1\\file.js'));
|
||||
assertResolve(URI.file('\\\\server\\share\\some\\'), '\\file.js', URI.file('\\\\server\\share\\file.js'));
|
||||
|
||||
assertResolve(URI.file('c:\\'), '\\\\server\\share\\some\\', URI.file('\\\\server\\share\\some'));
|
||||
assertResolve(URI.file('\\\\server\\share\\some\\'), 'c:\\', URI.file('c:\\'));
|
||||
} else {
|
||||
assertResolve(URI.file('/foo/bar'), 'file.js', URI.file('/foo/bar/file.js'));
|
||||
assertResolve(URI.file('/foo/bar'), './file.js', URI.file('/foo/bar/file.js'));
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
'use strict';
|
||||
|
||||
function createModuleDescription(name, exclude) {
|
||||
var result = {};
|
||||
var excludes = ['vs/css', 'vs/nls'];
|
||||
const result = {};
|
||||
|
||||
let excludes = ['vs/css', 'vs/nls'];
|
||||
result.name = name;
|
||||
if (Array.isArray(exclude) && exclude.length > 0) {
|
||||
excludes = excludes.concat(exclude);
|
||||
|
||||
@@ -41,13 +41,14 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IDisposable, dispose, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { DownloadService } from 'vs/platform/download/node/downloadService';
|
||||
import { IDownloadService } from 'vs/platform/download/common/download';
|
||||
import { StaticRouter, IServerChannel, IChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { StaticRouter } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { NodeCachedDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/nodeCachedDataCleaner';
|
||||
import { LanguagePackCachedDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/languagePackCachedDataCleaner';
|
||||
import { StorageDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/storageDataCleaner';
|
||||
import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
|
||||
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
|
||||
export interface ISharedProcessConfiguration {
|
||||
readonly machineId: string;
|
||||
|
||||
@@ -8,6 +8,32 @@
|
||||
|
||||
(function () {
|
||||
|
||||
function uriFromPath(_path) {
|
||||
let pathName = _path.replace(/\\/g, '/');
|
||||
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
|
||||
pathName = '/' + pathName;
|
||||
}
|
||||
|
||||
let uri;
|
||||
if (navigator.userAgent.indexOf('Windows') >= 0 && pathName.startsWith('//')) { // specially handle Windows UNC paths
|
||||
uri = encodeURI('file:' + pathName);
|
||||
} else {
|
||||
uri = encodeURI('file://' + pathName);
|
||||
}
|
||||
|
||||
return uri.replace(/#/g, '%23');
|
||||
}
|
||||
|
||||
function parseURLQueryArgs() {
|
||||
const search = window.location.search || '';
|
||||
|
||||
return search.split(/[?&]/)
|
||||
.filter(function (param) { return !!param; })
|
||||
.map(function (param) { return param.split('='); })
|
||||
.filter(function (param) { return param.length === 2; })
|
||||
.reduce(function (r, param) { r[param[0]] = decodeURIComponent(param[1]); return r; }, {});
|
||||
}
|
||||
|
||||
function loadScript(path, callback) {
|
||||
let script = document.createElement('script');
|
||||
script.onload = callback;
|
||||
@@ -17,11 +43,14 @@
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
|
||||
loadScript('../../../../../src/vs/loader.js', function () {
|
||||
loadScript('../../../../../out/vs/loader.js', function () {
|
||||
|
||||
const args = parseURLQueryArgs();
|
||||
const configuration = JSON.parse(args['config'] || '{}') || {};
|
||||
|
||||
// @ts-ignore
|
||||
require.config({
|
||||
baseUrl: 'file:../../../../../out'
|
||||
baseUrl: uriFromPath(configuration.appRoot) + '/out',
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
|
||||
@@ -55,7 +55,7 @@ import { LogLevelSetterChannel } from 'vs/platform/log/node/logIpc';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import { ElectronURLListener } from 'vs/platform/url/electron-main/electronUrlListener';
|
||||
import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver';
|
||||
import { connectRemoteAgentManagement, RemoteAgentConnectionContext } from 'vs/platform/remote/node/remoteAgentConnection';
|
||||
import { connectRemoteAgentManagement } from 'vs/platform/remote/node/remoteAgentConnection';
|
||||
import { IMenubarService } from 'vs/platform/menubar/common/menubar';
|
||||
import { MenubarService } from 'vs/platform/menubar/electron-main/menubarService';
|
||||
import { MenubarChannel } from 'vs/platform/menubar/node/menubarIpc';
|
||||
@@ -78,6 +78,7 @@ import { IBackupMainService } from 'vs/platform/backup/common/backup';
|
||||
import { HistoryMainService } from 'vs/platform/history/electron-main/historyMainService';
|
||||
import { URLService } from 'vs/platform/url/common/urlService';
|
||||
import { WorkspacesMainService } from 'vs/platform/workspaces/electron-main/workspacesMainService';
|
||||
import { RemoteAgentConnectionContext } from 'vs/platform/remote/common/remoteAgentEnvironment';
|
||||
|
||||
export class CodeApplication extends Disposable {
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
this._win.webContents.session.webRequest.onBeforeSendHeaders({ urls }, (details: any, cb: any) => {
|
||||
this.marketplaceHeadersPromise.then(headers => {
|
||||
const requestHeaders = objects.assign(details.requestHeaders, headers);
|
||||
if (this.configurationService.getValue('extensions.enableExperimentalAzureSearch')) {
|
||||
if (!this.configurationService.getValue('extensions.disableExperimentalAzureSearch')) {
|
||||
requestHeaders['Cookie'] = `${requestHeaders['Cookie'] ? requestHeaders['Cookie'] + ';' : ''}EnableExternalSearchForVSCode=true`;
|
||||
}
|
||||
cb({ cancel: false, requestHeaders });
|
||||
|
||||
@@ -691,7 +691,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
}
|
||||
|
||||
// Handle empty to restore
|
||||
const allEmptyToRestore = arrays.distinct(emptyToRestore, info => info.backupFolder || ''); // prevent duplicates
|
||||
const allEmptyToRestore = arrays.distinct(emptyToRestore, info => info.backupFolder); // prevent duplicates
|
||||
if (allEmptyToRestore.length > 0) {
|
||||
allEmptyToRestore.forEach(emptyWindowBackupInfo => {
|
||||
const remoteAuthority = emptyWindowBackupInfo.remoteAuthority;
|
||||
@@ -1247,7 +1247,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
// For all other cases we first call into registerEmptyWindowBackupSync() to set it before
|
||||
// loading the window.
|
||||
if (options.emptyWindowBackupInfo) {
|
||||
configuration.backupPath = join(this.environmentService.backupHome, options.emptyWindowBackupInfo.backupFolder!);
|
||||
configuration.backupPath = join(this.environmentService.backupHome, options.emptyWindowBackupInfo.backupFolder);
|
||||
}
|
||||
|
||||
let window: ICodeWindow | undefined;
|
||||
@@ -1352,7 +1352,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
configuration.backupPath = this.backupMainService.registerFolderBackupSync(configuration.folderUri);
|
||||
} else {
|
||||
const backupFolder = options.emptyWindowBackupInfo && options.emptyWindowBackupInfo.backupFolder;
|
||||
configuration.backupPath = this.backupMainService.registerEmptyWindowBackupSync({ backupFolder, remoteAuthority: configuration.remoteAuthority });
|
||||
configuration.backupPath = this.backupMainService.registerEmptyWindowBackupSync(backupFolder, configuration.remoteAuthority);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { flatten, isNonEmptyArray, mergeSort } from 'vs/base/common/arrays';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { equals, flatten, isNonEmptyArray, mergeSort } from 'vs/base/common/arrays';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { illegalArgument, isPromiseCanceledError, onUnexpectedExternalError } from 'vs/base/common/errors';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { registerLanguageCommand } from 'vs/editor/browser/editorExtensions';
|
||||
@@ -13,7 +13,7 @@ import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { CodeAction, CodeActionContext, CodeActionProviderRegistry, CodeActionTrigger as CodeActionTriggerKind } from 'vs/editor/common/modes';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { CodeActionKind, CodeActionTrigger, filtersAction, mayIncludeActionsOfKind, CodeActionFilter } from './codeActionTrigger';
|
||||
import { CodeActionFilter, CodeActionKind, CodeActionTrigger, filtersAction, mayIncludeActionsOfKind } from './codeActionTrigger';
|
||||
|
||||
export class CodeActionSet {
|
||||
|
||||
@@ -55,8 +55,13 @@ export function getCodeActions(
|
||||
trigger: trigger.type === 'manual' ? CodeActionTriggerKind.Manual : CodeActionTriggerKind.Automatic
|
||||
};
|
||||
|
||||
const promises = getCodeActionProviders(model, filter).map(provider => {
|
||||
return Promise.resolve(provider.provideCodeActions(model, rangeOrSelection, codeActionContext, token)).then(providedCodeActions => {
|
||||
const chainedCancellation = new CancellationTokenSource();
|
||||
token.onCancellationRequested(() => chainedCancellation.cancel());
|
||||
|
||||
const providers = getCodeActionProviders(model, filter);
|
||||
|
||||
const promises = providers.map(provider => {
|
||||
return Promise.resolve(provider.provideCodeActions(model, rangeOrSelection, codeActionContext, chainedCancellation.token)).then(providedCodeActions => {
|
||||
if (!Array.isArray(providedCodeActions)) {
|
||||
return [];
|
||||
}
|
||||
@@ -71,9 +76,19 @@ export function getCodeActions(
|
||||
});
|
||||
});
|
||||
|
||||
const listener = CodeActionProviderRegistry.onDidChange(() => {
|
||||
const newProviders = CodeActionProviderRegistry.all(model);
|
||||
if (!equals(newProviders, providers)) {
|
||||
chainedCancellation.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
return Promise.all(promises)
|
||||
.then(flatten)
|
||||
.then(actions => new CodeActionSet(actions));
|
||||
.then(actions => new CodeActionSet(actions))
|
||||
.finally(() => {
|
||||
listener.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
function getCodeActionProviders(
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { CancelablePromise } from 'vs/base/common/async';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { escapeRegExpCharacters } from 'vs/base/common/strings';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { EditorAction, EditorCommand, ServicesAccessor } from 'vs/editor/browser/editorExtensions';
|
||||
@@ -35,7 +35,7 @@ function contextKeyForSupportedActions(kind: CodeActionKind) {
|
||||
new RegExp('(\\s|^)' + escapeRegExpCharacters(kind.value) + '\\b'));
|
||||
}
|
||||
|
||||
export class QuickFixController implements IEditorContribution {
|
||||
export class QuickFixController extends Disposable implements IEditorContribution {
|
||||
|
||||
private static readonly ID = 'editor.contrib.quickFixController';
|
||||
|
||||
@@ -47,11 +47,11 @@ export class QuickFixController implements IEditorContribution {
|
||||
private readonly _model: CodeActionModel;
|
||||
private readonly _codeActionContextMenu: CodeActionContextMenu;
|
||||
private readonly _lightBulbWidget: LightBulbWidget;
|
||||
private readonly _disposables: IDisposable[] = [];
|
||||
|
||||
private _activeRequest: CancelablePromise<CodeActionSet> | undefined;
|
||||
|
||||
constructor(editor: ICodeEditor,
|
||||
constructor(
|
||||
editor: ICodeEditor,
|
||||
@IMarkerService markerService: IMarkerService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IProgressService progressService: IProgressService,
|
||||
@@ -60,24 +60,24 @@ export class QuickFixController implements IEditorContribution {
|
||||
@IKeybindingService private readonly _keybindingService: IKeybindingService,
|
||||
@IBulkEditService private readonly _bulkEditService: IBulkEditService,
|
||||
) {
|
||||
super();
|
||||
|
||||
this._editor = editor;
|
||||
this._model = new CodeActionModel(this._editor, markerService, contextKeyService, progressService);
|
||||
this._codeActionContextMenu = new CodeActionContextMenu(editor, contextMenuService, action => this._onApplyCodeAction(action));
|
||||
this._lightBulbWidget = new LightBulbWidget(editor);
|
||||
this._lightBulbWidget = this._register(new LightBulbWidget(editor));
|
||||
|
||||
this._updateLightBulbTitle();
|
||||
|
||||
this._disposables.push(
|
||||
this._codeActionContextMenu.onDidExecuteCodeAction(_ => this._model.trigger({ type: 'auto', filter: {} })),
|
||||
this._lightBulbWidget.onClick(this._handleLightBulbSelect, this),
|
||||
this._model.onDidChangeState(e => this._onDidChangeCodeActionsState(e)),
|
||||
this._keybindingService.onDidUpdateKeybindings(this._updateLightBulbTitle, this)
|
||||
);
|
||||
this._register(this._codeActionContextMenu.onDidExecuteCodeAction(_ => this._model.trigger({ type: 'auto', filter: {} })));
|
||||
this._register(this._lightBulbWidget.onClick(this._handleLightBulbSelect, this));
|
||||
this._register(this._model.onDidChangeState(e => this._onDidChangeCodeActionsState(e)));
|
||||
this._register(this._keybindingService.onDidUpdateKeybindings(this._updateLightBulbTitle, this));
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
super.dispose();
|
||||
this._model.dispose();
|
||||
dispose(this._disposables);
|
||||
}
|
||||
|
||||
private _onDidChangeCodeActionsState(newState: CodeActionsState.State): void {
|
||||
|
||||
@@ -23,7 +23,7 @@ export interface IBackupWorkspacesFormat {
|
||||
export const IBackupMainService = createDecorator<IBackupMainService>('backupMainService');
|
||||
|
||||
export interface IEmptyWindowBackupInfo {
|
||||
backupFolder?: string;
|
||||
backupFolder: string;
|
||||
remoteAuthority?: string;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export interface IBackupMainService {
|
||||
|
||||
registerWorkspaceBackupSync(workspace: IWorkspaceBackupInfo, migrateFrom?: string): string;
|
||||
registerFolderBackupSync(folderUri: URI): string;
|
||||
registerEmptyWindowBackupSync(backupInfo: IEmptyWindowBackupInfo): string;
|
||||
registerEmptyWindowBackupSync(backupFolder?: string, remoteAuthority?: string): string;
|
||||
|
||||
unregisterWorkspaceBackupSync(workspace: IWorkspaceIdentifier): void;
|
||||
unregisterFolderBackupSync(folderUri: URI): void;
|
||||
|
||||
@@ -213,9 +213,7 @@ export class BackupMainService implements IBackupMainService {
|
||||
}
|
||||
}
|
||||
|
||||
registerEmptyWindowBackupSync(backupInfo: IEmptyWindowBackupInfo): string {
|
||||
let backupFolder = backupInfo.backupFolder;
|
||||
let remoteAuthority = backupInfo.remoteAuthority;
|
||||
registerEmptyWindowBackupSync(backupFolder?: string, remoteAuthority?: string): string {
|
||||
|
||||
// Generate a new folder if this is a new empty workspace
|
||||
if (!backupFolder) {
|
||||
|
||||
@@ -643,8 +643,8 @@ suite('BackupMainService', () => {
|
||||
});
|
||||
|
||||
test('should remove empty workspaces from workspaces.json', () => {
|
||||
service.registerEmptyWindowBackupSync({ backupFolder: 'foo' });
|
||||
service.registerEmptyWindowBackupSync({ backupFolder: 'bar' });
|
||||
service.registerEmptyWindowBackupSync('foo');
|
||||
service.registerEmptyWindowBackupSync('bar');
|
||||
service.unregisterEmptyWindowBackupSync('foo');
|
||||
return pfs.readFile(backupWorkspacesPath, 'utf-8').then(buffer => {
|
||||
const json = <IBackupWorkspacesFormat>JSON.parse(buffer);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { WorkspaceStats, collectWorkspaceStats } from 'vs/base/node/stats';
|
||||
import { IMainProcessInfo } from 'vs/platform/launch/electron-main/launchService';
|
||||
import { ProcessItem, listProcesses } from 'vs/base/node/ps';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
@@ -13,9 +12,10 @@ import { virtualMachineHint } from 'vs/base/node/id';
|
||||
import { repeat, pad } from 'vs/base/common/strings';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { app } from 'electron';
|
||||
import { basename } from 'vs/base/common/path';
|
||||
import { basename, join } from 'vs/base/common/path';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { readdir, stat } from 'fs';
|
||||
|
||||
export const ID = 'diagnosticsService';
|
||||
export const IDiagnosticsService = createDecorator<IDiagnosticsService>(ID);
|
||||
@@ -247,14 +247,14 @@ export class DiagnosticsService implements IDiagnosticsService {
|
||||
output.push(line);
|
||||
}
|
||||
|
||||
if (workspaceStats.launchConfigFiles.length > 0) {
|
||||
let line = '| Launch Configs:';
|
||||
workspaceStats.launchConfigFiles.forEach(each => {
|
||||
const item = each.count > 1 ? ` ${each.name}(${each.count})` : ` ${each.name}`;
|
||||
line += item;
|
||||
});
|
||||
output.push(line);
|
||||
}
|
||||
// if (workspaceStats.launchConfigFiles.length > 0) {
|
||||
// let line = '| Launch Configs:';
|
||||
// workspaceStats.launchConfigFiles.forEach(each => {
|
||||
// const item = each.count > 1 ? ` ${each.name}(${each.count})` : ` ${each.name}`;
|
||||
// line += item;
|
||||
// });
|
||||
// output.push(line);
|
||||
// }
|
||||
return output.join('\n');
|
||||
}
|
||||
|
||||
@@ -305,3 +305,197 @@ export class DiagnosticsService implements IDiagnosticsService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface WorkspaceStatItem {
|
||||
name: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
interface WorkspaceStats {
|
||||
fileTypes: WorkspaceStatItem[];
|
||||
configFiles: WorkspaceStatItem[];
|
||||
fileCount: number;
|
||||
maxFilesReached: boolean;
|
||||
// launchConfigFiles: WorkspaceStatItem[];
|
||||
}
|
||||
|
||||
function asSortedItems(map: Map<string, number>): WorkspaceStatItem[] {
|
||||
const a: WorkspaceStatItem[] = [];
|
||||
map.forEach((value, index) => a.push({ name: index, count: value }));
|
||||
return a.sort((a, b) => b.count - a.count);
|
||||
}
|
||||
|
||||
// function collectLaunchConfigs(folder: string): Promise<WorkspaceStatItem[]> {
|
||||
// const launchConfigs = new Map<string, number>();
|
||||
|
||||
// const launchConfig = join(folder, '.vscode', 'launch.json');
|
||||
// return new Promise((resolve, reject) => {
|
||||
// exists(launchConfig, (doesExist) => {
|
||||
// if (doesExist) {
|
||||
// readFile(launchConfig, (err, contents) => {
|
||||
// if (err) {
|
||||
// return resolve([]);
|
||||
// }
|
||||
|
||||
// const errors: ParseError[] = [];
|
||||
// const json = parse(contents.toString(), errors);
|
||||
// if (errors.length) {
|
||||
// console.log(`Unable to parse ${launchConfig}`);
|
||||
// return resolve([]);
|
||||
// }
|
||||
|
||||
// if (json['configurations']) {
|
||||
// for (const each of json['configurations']) {
|
||||
// const type = each['type'];
|
||||
// if (type) {
|
||||
// if (launchConfigs.has(type)) {
|
||||
// launchConfigs.set(type, launchConfigs.get(type)! + 1);
|
||||
// } else {
|
||||
// launchConfigs.set(type, 1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// return resolve(asSortedItems(launchConfigs));
|
||||
// });
|
||||
// } else {
|
||||
// return resolve([]);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
function collectWorkspaceStats(folder: string, filter: string[]): Promise<WorkspaceStats> {
|
||||
const configFilePatterns = [
|
||||
{ 'tag': 'grunt.js', 'pattern': /^gruntfile\.js$/i },
|
||||
{ 'tag': 'gulp.js', 'pattern': /^gulpfile\.js$/i },
|
||||
{ 'tag': 'tsconfig.json', 'pattern': /^tsconfig\.json$/i },
|
||||
{ 'tag': 'package.json', 'pattern': /^package\.json$/i },
|
||||
{ 'tag': 'jsconfig.json', 'pattern': /^jsconfig\.json$/i },
|
||||
{ 'tag': 'tslint.json', 'pattern': /^tslint\.json$/i },
|
||||
{ 'tag': 'eslint.json', 'pattern': /^eslint\.json$/i },
|
||||
{ 'tag': 'tasks.json', 'pattern': /^tasks\.json$/i },
|
||||
{ 'tag': 'launch.json', 'pattern': /^launch\.json$/i },
|
||||
{ 'tag': 'settings.json', 'pattern': /^settings\.json$/i },
|
||||
{ 'tag': 'webpack.config.js', 'pattern': /^webpack\.config\.js$/i },
|
||||
{ 'tag': 'project.json', 'pattern': /^project\.json$/i },
|
||||
{ 'tag': 'makefile', 'pattern': /^makefile$/i },
|
||||
{ 'tag': 'sln', 'pattern': /^.+\.sln$/i },
|
||||
{ 'tag': 'csproj', 'pattern': /^.+\.csproj$/i },
|
||||
{ 'tag': 'cmake', 'pattern': /^.+\.cmake$/i }
|
||||
];
|
||||
|
||||
const fileTypes = new Map<string, number>();
|
||||
const configFiles = new Map<string, number>();
|
||||
|
||||
const MAX_FILES = 20000;
|
||||
|
||||
function walk(dir: string, filter: string[], token, done: (allFiles: string[]) => void): void {
|
||||
let results: string[] = [];
|
||||
readdir(dir, async (err, files) => {
|
||||
// Ignore folders that can't be read
|
||||
if (err) {
|
||||
return done(results);
|
||||
}
|
||||
|
||||
let pending = files.length;
|
||||
if (pending === 0) {
|
||||
return done(results);
|
||||
}
|
||||
|
||||
for (const file of files) {
|
||||
if (token.maxReached) {
|
||||
return done(results);
|
||||
}
|
||||
|
||||
stat(join(dir, file), (err, stats) => {
|
||||
// Ignore files that can't be read
|
||||
if (err) {
|
||||
if (--pending === 0) {
|
||||
return done(results);
|
||||
}
|
||||
} else {
|
||||
if (stats.isDirectory()) {
|
||||
if (filter.indexOf(file) === -1) {
|
||||
walk(join(dir, file), filter, token, (res: string[]) => {
|
||||
results = results.concat(res);
|
||||
|
||||
if (--pending === 0) {
|
||||
return done(results);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (--pending === 0) {
|
||||
done(results);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (token.count >= MAX_FILES) {
|
||||
token.maxReached = true;
|
||||
}
|
||||
|
||||
token.count++;
|
||||
results.push(file);
|
||||
|
||||
if (--pending === 0) {
|
||||
done(results);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const addFileType = (fileType: string) => {
|
||||
if (fileTypes.has(fileType)) {
|
||||
fileTypes.set(fileType, fileTypes.get(fileType)! + 1);
|
||||
}
|
||||
else {
|
||||
fileTypes.set(fileType, 1);
|
||||
}
|
||||
};
|
||||
|
||||
const addConfigFiles = (fileName: string) => {
|
||||
for (const each of configFilePatterns) {
|
||||
if (each.pattern.test(fileName)) {
|
||||
if (configFiles.has(each.tag)) {
|
||||
configFiles.set(each.tag, configFiles.get(each.tag)! + 1);
|
||||
} else {
|
||||
configFiles.set(each.tag, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const acceptFile = (name: string) => {
|
||||
if (name.lastIndexOf('.') >= 0) {
|
||||
const suffix: string | undefined = name.split('.').pop();
|
||||
if (suffix) {
|
||||
addFileType(suffix);
|
||||
}
|
||||
}
|
||||
addConfigFiles(name);
|
||||
};
|
||||
|
||||
const token: { count: number, maxReached: boolean } = { count: 0, maxReached: false };
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
walk(folder, filter, token, async (files) => {
|
||||
files.forEach(acceptFile);
|
||||
|
||||
// TODO@rachel commented out due to severe performance issues
|
||||
// see https://github.com/Microsoft/vscode/issues/70563
|
||||
// const launchConfigs = await collectLaunchConfigs(folder);
|
||||
|
||||
resolve({
|
||||
configFiles: asSortedItems(configFiles),
|
||||
fileTypes: asSortedItems(fileTypes),
|
||||
fileCount: token.count,
|
||||
maxFilesReached: token.maxReached,
|
||||
// launchConfigFiles: launchConfigs
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IDialogService, IConfirmation, IConfirmationResult } from 'vs/platform/dialogs/common/dialogs';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as fs from 'fs';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IDownloadService } from 'vs/platform/download/common/download';
|
||||
import { mkdirp } from 'vs/base/node/pfs';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { connect as connectNet, Client } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
export const ID = 'driverService';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IExtensionManagementService, ILocalExtension, InstallExtensionEvent, DidInstallExtensionEvent, IGalleryExtension, DidUninstallExtensionEvent, IExtensionIdentifier, IGalleryMetadata, IReportedExtension } from '../common/extensionManagement';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
|
||||
@@ -228,6 +228,15 @@ export class ExtensionIdentifier {
|
||||
}
|
||||
}
|
||||
|
||||
export interface IExtensionDescription extends IExtensionManifest {
|
||||
readonly identifier: ExtensionIdentifier;
|
||||
readonly uuid?: string;
|
||||
readonly isBuiltin: boolean;
|
||||
readonly isUnderDevelopment: boolean;
|
||||
readonly extensionLocation: URI;
|
||||
enableProposedApi?: boolean;
|
||||
}
|
||||
|
||||
export function isLanguagePackExtension(manifest: IExtensionManifest): boolean {
|
||||
return manifest.contributes && manifest.contributes.localizations ? manifest.contributes.localizations.length > 0 : false;
|
||||
}
|
||||
@@ -48,38 +48,44 @@ export class HistoryMainService implements IHistoryMainService {
|
||||
}
|
||||
|
||||
addRecentlyOpened(newlyAdded: IRecent[]): void {
|
||||
const mru = this.getRecentlyOpened();
|
||||
const workspaces: Array<IRecentFolder | IRecentWorkspace> = [];
|
||||
const files: IRecentFile[] = [];
|
||||
|
||||
for (let curr of newlyAdded) {
|
||||
if (isRecentWorkspace(curr)) {
|
||||
if (!this.workspacesMainService.isUntitledWorkspace(curr.workspace) && indexOfWorkspace(mru.workspaces, curr.workspace) === -1) {
|
||||
mru.workspaces.unshift(curr);
|
||||
if (!this.workspacesMainService.isUntitledWorkspace(curr.workspace) && indexOfWorkspace(workspaces, curr.workspace) === -1) {
|
||||
workspaces.push(curr);
|
||||
}
|
||||
} else if (isRecentFolder(curr)) {
|
||||
if (indexOfFolder(mru.workspaces, curr.folderUri) === -1) {
|
||||
mru.workspaces.unshift(curr);
|
||||
if (indexOfFolder(workspaces, curr.folderUri) === -1) {
|
||||
workspaces.push(curr);
|
||||
}
|
||||
} else {
|
||||
if (indexOfFile(mru.files, curr.fileUri) === -1) {
|
||||
mru.files.unshift(curr);
|
||||
if (indexOfFile(files, curr.fileUri) === -1) {
|
||||
files.push(curr);
|
||||
// Add to recent documents (Windows only, macOS later)
|
||||
if (isWindows && curr.fileUri.scheme === Schemas.file) {
|
||||
app.addRecentDocument(curr.fileUri.fsPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure its bounded
|
||||
mru.workspaces = mru.workspaces.slice(0, HistoryMainService.MAX_TOTAL_RECENT_ENTRIES);
|
||||
mru.files = mru.files.slice(0, HistoryMainService.MAX_TOTAL_RECENT_ENTRIES);
|
||||
this.addEntriesFromStorage(workspaces, files);
|
||||
|
||||
this.saveRecentlyOpened(mru);
|
||||
this._onRecentlyOpenedChange.fire();
|
||||
if (workspaces.length > HistoryMainService.MAX_TOTAL_RECENT_ENTRIES) {
|
||||
workspaces.length = HistoryMainService.MAX_TOTAL_RECENT_ENTRIES;
|
||||
}
|
||||
if (files.length > HistoryMainService.MAX_TOTAL_RECENT_ENTRIES) {
|
||||
files.length = HistoryMainService.MAX_TOTAL_RECENT_ENTRIES;
|
||||
}
|
||||
|
||||
// Schedule update to recent documents on macOS dock
|
||||
if (isMacintosh) {
|
||||
this.macOSRecentDocumentsUpdater.trigger(() => this.updateMacOSRecentDocuments());
|
||||
}
|
||||
this.saveRecentlyOpened({ workspaces, files });
|
||||
this._onRecentlyOpenedChange.fire();
|
||||
|
||||
// Schedule update to recent documents on macOS dock
|
||||
if (isMacintosh) {
|
||||
this.macOSRecentDocumentsUpdater.trigger(() => this.updateMacOSRecentDocuments());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +183,12 @@ export class HistoryMainService implements IHistoryMainService {
|
||||
}
|
||||
}
|
||||
}
|
||||
this.addEntriesFromStorage(workspaces, files);
|
||||
|
||||
return { workspaces, files };
|
||||
}
|
||||
|
||||
private addEntriesFromStorage(workspaces: Array<IRecentFolder | IRecentWorkspace>, files: IRecentFile[]) {
|
||||
// Get from storage
|
||||
let recents = this.getRecentlyOpenedFromStorage();
|
||||
for (let recent of recents.workspaces) {
|
||||
@@ -196,7 +207,6 @@ export class HistoryMainService implements IHistoryMainService {
|
||||
files.push(recent);
|
||||
}
|
||||
}
|
||||
return { workspaces, files };
|
||||
}
|
||||
|
||||
private getRecentlyOpenedFromStorage(): IRecentlyOpened {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Client } from 'vs/base/parts/ipc/electron-browser/ipc.electron-browser';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/co
|
||||
import { Client, connect } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IChannel, getDelayedChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { getDelayedChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
|
||||
export const ISharedProcessService = createDecorator<ISharedProcessService>('sharedProcessService');
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IIssueService, IssueReporterData, ProcessExplorerData } from 'vs/platform/issue/common/issue';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
|
||||
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IIssueService } from 'vs/platform/issue/common/issue';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IURLService } from 'vs/platform/url/common/url';
|
||||
import { IProcessEnvironment, isMacintosh } from 'vs/base/common/platform';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { ILocalizationsService, LanguageType } from 'vs/platform/localizations/common/localizations';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { LogLevel, ILogService, DelegatedLogService } from 'vs/platform/log/common/log';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IMenubarService, IMenubarData } from 'vs/platform/menubar/common/menubar';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
|
||||
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IMenubarService } from 'vs/platform/menubar/common/menubar';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { OperatingSystem } from 'vs/base/common/platform';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
export interface IRemoteAgentEnvironment {
|
||||
pid: number;
|
||||
appRoot: URI;
|
||||
appSettingsHome: URI;
|
||||
logsPath: URI;
|
||||
extensionsPath: URI;
|
||||
extensionHostLogsPath: URI;
|
||||
globalStorageHome: URI;
|
||||
userHome: URI;
|
||||
extensions: IExtensionDescription[];
|
||||
os: OperatingSystem;
|
||||
syncExtensions: boolean;
|
||||
}
|
||||
|
||||
export interface RemoteAgentConnectionContext {
|
||||
remoteAuthority: string;
|
||||
clientId: string;
|
||||
}
|
||||
@@ -4,11 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Client, BufferedProtocol } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
|
||||
export interface RemoteAgentConnectionContext {
|
||||
remoteAuthority: string;
|
||||
clientId: string;
|
||||
}
|
||||
import { RemoteAgentConnectionContext } from 'vs/platform/remote/common/remoteAgentEnvironment';
|
||||
|
||||
export function connectRemoteAgentManagement(remoteAuthority: string, host: string, port: number, clientId: string, isBuilt: boolean): Promise<Client<RemoteAgentConnectionContext>> {
|
||||
throw new Error(`Not implemented`);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { IChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { FileChangeType, FileDeleteOptions, FileOverwriteOptions, FileSystemProviderCapabilities, FileType, FileWriteOptions, IFileChange, IFileSystemProvider, IStat, IWatchOptions } from 'vs/platform/files/common/files';
|
||||
|
||||
export const REMOTE_FILE_SYSTEM_CHANNEL_NAME = 'remotefilesystem';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { IConfigurationRegistry, Extensions } from 'vs/platform/configuration/co
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
export const IRequestService = createDecorator<IRequestService>('requestService2');
|
||||
export const IRequestService = createDecorator<IRequestService>('requestService');
|
||||
|
||||
export interface IRequestService {
|
||||
_serviceBrand: any;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { StorageMainService, IStorageChangeEvent } from 'vs/platform/storage/node/storageMainService';
|
||||
import { IUpdateRequest, IStorageDatabase, IStorageItemsChangeEvent } from 'vs/base/node/storage';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { ITelemetryAppender } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IUpdateService, State } from 'vs/platform/update/common/update';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IUpdateService } from 'vs/platform/update/common/update';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, CrashReporterStartOptions, IMessageBoxResult, MessageBoxOptions, SaveDialogOptions, OpenDialogOptions, IDevToolsOptions, INewWindowOptions, IURIToOpen } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IRecentlyOpened, IRecent, isRecentWorkspace } from 'vs/platform/history/common/history';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IWindowsService, IURIToOpen } from 'vs/platform/windows/common/windows';
|
||||
import { reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
@@ -173,7 +173,7 @@ const SLASH = '/';
|
||||
*/
|
||||
export function getStoredWorkspaceFolder(folderURI: URI, folderName: string | undefined, targetConfigFolderURI: URI, useSlashForPath = !isWindows): IStoredWorkspaceFolder {
|
||||
|
||||
if (folderURI.scheme !== targetConfigFolderURI.scheme || !isEqualAuthority(folderURI.authority, targetConfigFolderURI.authority)) {
|
||||
if (folderURI.scheme !== targetConfigFolderURI.scheme) {
|
||||
return { name: folderName, uri: folderURI.toString(true) };
|
||||
}
|
||||
|
||||
@@ -200,6 +200,9 @@ export function getStoredWorkspaceFolder(folderURI: URI, folderName: string | un
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!isEqualAuthority(folderURI.authority, targetConfigFolderURI.authority)) {
|
||||
return { name: folderName, uri: folderURI.toString(true) };
|
||||
}
|
||||
folderPath = folderURI.path;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IWorkspacesService, IWorkspaceIdentifier, IWorkspaceFolderCreationData, reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
|
||||
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IWorkspaceIdentifier, IWorkspaceFolderCreationData, IWorkspacesMainService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
@@ -316,6 +316,31 @@ suite('WorkspacesMainService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('rewriteWorkspaceFileForNewLocation (unc paths)', () => {
|
||||
if (!isWindows) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const workspaceLocation = path.join(os.tmpdir(), 'wsloc');
|
||||
const folder1Location = 'x:\\foo';
|
||||
const folder2Location = '\\\\server\\share2\\some\\path';
|
||||
const folder3Location = path.join(os.tmpdir(), 'wsloc', 'inner', 'more');
|
||||
|
||||
return createWorkspace([folder1Location, folder2Location, folder3Location]).then(workspace => {
|
||||
const workspaceConfigPath = URI.file(path.join(workspaceLocation, `myworkspace.${Date.now()}.${WORKSPACE_EXTENSION}`));
|
||||
let origContent = fs.readFileSync(workspace.configPath.fsPath).toString();
|
||||
|
||||
const newContent = rewriteWorkspaceFileForNewLocation(origContent, workspace.configPath, workspaceConfigPath);
|
||||
|
||||
const ws = JSON.parse(newContent) as IStoredWorkspace;
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, folder1Location);
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, folder2Location);
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[2]).path, 'inner\\more');
|
||||
|
||||
service.deleteUntitledWorkspaceSync(workspace);
|
||||
});
|
||||
});
|
||||
|
||||
test('deleteUntitledWorkspaceSync (untitled)', () => {
|
||||
return createWorkspace([process.cwd(), os.tmpdir()]).then(workspace => {
|
||||
assert.ok(fs.existsSync(workspace.configPath.fsPath));
|
||||
|
||||
Vendored
+60
-10
@@ -635,6 +635,22 @@ declare module 'vscode' {
|
||||
|
||||
//#region André: debug
|
||||
|
||||
export namespace debug {
|
||||
|
||||
/**
|
||||
* Start debugging by using either a named launch or named compound configuration,
|
||||
* or by directly passing a [DebugConfiguration](#DebugConfiguration).
|
||||
* The named configurations are looked up in '.vscode/launch.json' found in the given folder.
|
||||
* Before debugging starts, all unsaved files are saved and the launch configurations are brought up-to-date.
|
||||
* Folder specific variables used in the configuration (e.g. '${workspaceFolder}') are resolved against the given folder.
|
||||
* @param folder The [workspace folder](#WorkspaceFolder) for looking up named configurations and resolving variables or `undefined` for a non-folder setup.
|
||||
* @param nameOrConfiguration Either the name of a debug or compound configuration or a [DebugConfiguration](#DebugConfiguration) object.
|
||||
* @param parent If specified the newly created debug session is registered as a "child" session of a "parent" debug session.
|
||||
* @return A thenable that resolves when debugging could be successfully started.
|
||||
*/
|
||||
export function startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration, parentSession?: DebugSession): Thenable<boolean>;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
|
||||
export interface DebugConfigurationProvider {
|
||||
@@ -842,6 +858,11 @@ declare module 'vscode' {
|
||||
* Defaults to Collapsed.
|
||||
*/
|
||||
collapsibleState?: CommentThreadCollapsibleState;
|
||||
|
||||
/**
|
||||
* Dispose this comment thread.
|
||||
* Once disposed, the comment thread will be removed from visible text editors and Comments Panel.
|
||||
*/
|
||||
dispose?(): void;
|
||||
}
|
||||
|
||||
@@ -860,7 +881,8 @@ declare module 'vscode' {
|
||||
body: MarkdownString;
|
||||
|
||||
/**
|
||||
* Label describing the [Comment](#Comment)
|
||||
* Optional label describing the [Comment](#Comment)
|
||||
* Label will be rendered next to userName if exists.
|
||||
*/
|
||||
label?: string;
|
||||
|
||||
@@ -874,7 +896,6 @@ declare module 'vscode' {
|
||||
*/
|
||||
userIconPath?: Uri;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Use userIconPath instead. The avatar src of the user who created the comment
|
||||
*/
|
||||
@@ -911,13 +932,30 @@ declare module 'vscode' {
|
||||
*/
|
||||
selectCommand?: Command;
|
||||
|
||||
/**
|
||||
* The command to be executed when users try to save the edits to the comment
|
||||
*/
|
||||
editCommand?: Command;
|
||||
|
||||
/**
|
||||
* The command to be executed when users try to delete the comment
|
||||
*/
|
||||
deleteCommand?: Command;
|
||||
|
||||
/**
|
||||
* Deprecated
|
||||
*/
|
||||
isDraft?: boolean;
|
||||
|
||||
/**
|
||||
* Proposed Comment Reaction
|
||||
*/
|
||||
commentReactions?: CommentReaction[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated
|
||||
*/
|
||||
export interface CommentThreadChangedEvent {
|
||||
/**
|
||||
* Added comment threads.
|
||||
@@ -940,6 +978,9 @@ declare module 'vscode' {
|
||||
readonly inDraftMode: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comment Reactions
|
||||
*/
|
||||
interface CommentReaction {
|
||||
readonly label?: string;
|
||||
readonly iconPath?: string | Uri;
|
||||
@@ -1010,23 +1051,28 @@ declare module 'vscode' {
|
||||
onDidChangeCommentThreads: Event<CommentThreadChangedEvent>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The comment input box in Comment Widget.
|
||||
*/
|
||||
export interface CommentInputBox {
|
||||
|
||||
/**
|
||||
* Setter and getter for the contents of the input box.
|
||||
* Setter and getter for the contents of the comment input box.
|
||||
*/
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface CommentingRangeProvider {
|
||||
provideCommentingRanges(document: TextDocument, token: CancellationToken): ProviderResult<Range[]>;
|
||||
}
|
||||
|
||||
export interface CommentReactionProvider {
|
||||
availableReactions: CommentReaction[];
|
||||
toggleReaction?(document: TextDocument, comment: Comment, reaction: CommentReaction): Promise<void>;
|
||||
}
|
||||
|
||||
export interface CommentingRangeProvider {
|
||||
/**
|
||||
* Provide a list of ranges which allow new comment threads creation or null for a given document
|
||||
*/
|
||||
provideCommentingRanges(document: TextDocument, token: CancellationToken): ProviderResult<Range[]>;
|
||||
}
|
||||
|
||||
export interface EmptyCommentThreadFactory {
|
||||
/**
|
||||
* The method `createEmptyCommentThread` is called when users attempt to create new comment thread from the gutter or command palette.
|
||||
@@ -1050,7 +1096,11 @@ declare module 'vscode' {
|
||||
* The active (focused) [comment input box](#CommentInputBox).
|
||||
*/
|
||||
readonly inputBox?: CommentInputBox;
|
||||
createCommentThread(id: string, resource: Uri, range: Range): CommentThread;
|
||||
|
||||
/**
|
||||
* Create a [CommentThread](#CommentThread)
|
||||
*/
|
||||
createCommentThread(id: string, resource: Uri, range: Range, comments: Comment[]): CommentThread;
|
||||
|
||||
/**
|
||||
* Optional commenting range provider.
|
||||
@@ -1061,7 +1111,7 @@ declare module 'vscode' {
|
||||
/**
|
||||
* Optional new comment thread factory.
|
||||
*/
|
||||
emptyCommentThreadFactory: EmptyCommentThreadFactory;
|
||||
emptyCommentThreadFactory?: EmptyCommentThreadFactory;
|
||||
|
||||
/**
|
||||
* Optional reaction provider
|
||||
|
||||
@@ -19,10 +19,10 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { VIEWLET_ID as EXPLORER } from 'vs/workbench/contrib/files/common/files';
|
||||
import { VIEWLET_ID as SCM } from 'vs/workbench/contrib/scm/common/scm';
|
||||
import { VIEWLET_ID as DEBUG } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor, ShowViewletAction } from 'vs/workbench/browser/viewlet';
|
||||
import { IExtensionDescription, IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
|
||||
@@ -158,18 +158,18 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
|
||||
};
|
||||
if (hasProvide) {
|
||||
provider.provideDebugConfigurations = (folder) => {
|
||||
return Promise.resolve(this._proxy.$provideDebugConfigurations(handle, folder));
|
||||
return this._proxy.$provideDebugConfigurations(handle, folder);
|
||||
};
|
||||
}
|
||||
if (hasResolve) {
|
||||
provider.resolveDebugConfiguration = (folder, config) => {
|
||||
return Promise.resolve(this._proxy.$resolveDebugConfiguration(handle, folder, config));
|
||||
return this._proxy.$resolveDebugConfiguration(handle, folder, config);
|
||||
};
|
||||
}
|
||||
if (hasProvideDebugAdapter) {
|
||||
console.info('DebugConfigurationProvider.debugAdapterExecutable is deprecated and will be removed soon; please use DebugAdapterDescriptorFactory.createDebugAdapterDescriptor instead.');
|
||||
provider.debugAdapterExecutable = (folder) => {
|
||||
return Promise.resolve(this._proxy.$legacyDebugAdapterExecutable(handle, folder));
|
||||
return this._proxy.$legacyDebugAdapterExecutable(handle, folder);
|
||||
};
|
||||
}
|
||||
this._debugConfigurationProviders.set(handle, provider);
|
||||
@@ -226,10 +226,17 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
|
||||
}
|
||||
}
|
||||
|
||||
public $startDebugging(_folderUri: uri | undefined, nameOrConfiguration: string | IConfig): Promise<boolean> {
|
||||
private getSession(sessionId: DebugSessionUUID | undefined): IDebugSession | undefined {
|
||||
if (sessionId) {
|
||||
return this.debugService.getModel().getSessions(true).filter(s => s.getId() === sessionId).pop();
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $startDebugging(_folderUri: uri | undefined, nameOrConfiguration: string | IConfig, parentSessionID: DebugSessionUUID | undefined): Promise<boolean> {
|
||||
const folderUri = _folderUri ? uri.revive(_folderUri) : undefined;
|
||||
const launch = this.debugService.getConfigurationManager().getLaunch(folderUri);
|
||||
return this.debugService.startDebugging(launch, nameOrConfiguration).then(success => {
|
||||
return this.debugService.startDebugging(launch, nameOrConfiguration, false, this.getSession(parentSessionID)).then(success => {
|
||||
return success;
|
||||
}, err => {
|
||||
return Promise.reject(new Error(err && err.message ? err.message : 'cannot start debugging'));
|
||||
|
||||
@@ -7,30 +7,43 @@ import { SerializedError } from 'vs/base/common/errors';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { IExtHostContext, MainContext, MainThreadExtensionServiceShape } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IExtensionService, ExtensionActivationError } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ExtensionService } from 'vs/workbench/services/extensions/electron-browser/extensionService';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { localize } from 'vs/nls';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { EnablementState } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IExtensionsWorkbenchService, IExtension } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
|
||||
@extHostNamedCustomer(MainContext.MainThreadExtensionService)
|
||||
export class MainThreadExtensionService implements MainThreadExtensionServiceShape {
|
||||
|
||||
private readonly _extensionService: ExtensionService;
|
||||
private readonly _notificationService: INotificationService;
|
||||
private readonly _extensionsWorkbenchService: IExtensionsWorkbenchService;
|
||||
private readonly _windowService: IWindowService;
|
||||
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@IExtensionService extensionService: IExtensionService
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@INotificationService notificationService: INotificationService,
|
||||
@IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IWindowService windowService: IWindowService
|
||||
) {
|
||||
if (extensionService instanceof ExtensionService) {
|
||||
this._extensionService = extensionService;
|
||||
}
|
||||
this._notificationService = notificationService;
|
||||
this._extensionsWorkbenchService = extensionsWorkbenchService;
|
||||
this._windowService = windowService;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
}
|
||||
|
||||
$localShowMessage(severity: Severity, msg: string): void {
|
||||
this._extensionService._logOrShowMessage(severity, msg);
|
||||
}
|
||||
$activateExtension(extensionId: ExtensionIdentifier, activationEvent: string): Promise<void> {
|
||||
return this._extensionService._activateById(extensionId, activationEvent);
|
||||
}
|
||||
@@ -49,6 +62,66 @@ export class MainThreadExtensionService implements MainThreadExtensionServiceSha
|
||||
console.error(`[${extensionId}]${error.message}`);
|
||||
console.error(error.stack);
|
||||
}
|
||||
$onExtensionActivationFailed(extensionId: ExtensionIdentifier): void {
|
||||
async $onExtensionActivationError(extensionId: ExtensionIdentifier, activationError: ExtensionActivationError): Promise<void> {
|
||||
if (typeof activationError === 'string') {
|
||||
this._extensionService._logOrShowMessage(Severity.Error, activationError);
|
||||
} else {
|
||||
this._handleMissingDependency(extensionId, activationError.dependency);
|
||||
}
|
||||
}
|
||||
|
||||
private async _handleMissingDependency(extensionId: ExtensionIdentifier, missingDependency: string): Promise<void> {
|
||||
const extension = await this._extensionService.getExtension(extensionId.value);
|
||||
if (extension) {
|
||||
const local = await this._extensionsWorkbenchService.queryLocal();
|
||||
const installedDependency = local.filter(i => areSameExtensions(i.identifier, { id: missingDependency }))[0];
|
||||
if (installedDependency) {
|
||||
await this._handleMissingInstalledDependency(extension, installedDependency);
|
||||
} else {
|
||||
await this._handleMissingNotInstalledDependency(extension, missingDependency);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async _handleMissingInstalledDependency(extension: IExtensionDescription, missingInstalledDependency: IExtension): Promise<void> {
|
||||
const extName = extension.displayName || extension.name;
|
||||
if (missingInstalledDependency.enablementState === EnablementState.Enabled || missingInstalledDependency.enablementState === EnablementState.WorkspaceEnabled) {
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: localize('reload window', "Cannot activate extension '{0}' because it depends on extension '{1}', which is not loaded. Would you like to reload the window to load the extension?", extName, missingInstalledDependency.displayName),
|
||||
actions: {
|
||||
primary: [new Action('reload', localize('reload', "Reload Window"), '', true, () => this._windowService.reloadWindow())]
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: localize('disabledDep', "Cannot activate extension '{0}' because it depends on extension '{1}', which is disabled. Would you like to enable the extension and reload the window?", extName, missingInstalledDependency.displayName),
|
||||
actions: {
|
||||
primary: [new Action('enable', localize('enable dep', "Enable and Reload"), '', true,
|
||||
() => this._extensionsWorkbenchService.setEnablement([missingInstalledDependency], missingInstalledDependency.enablementState === EnablementState.Disabled ? EnablementState.Enabled : EnablementState.WorkspaceEnabled)
|
||||
.then(() => this._windowService.reloadWindow(), e => this._notificationService.error(e)))]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private async _handleMissingNotInstalledDependency(extension: IExtensionDescription, missingDependency: string): Promise<void> {
|
||||
const extName = extension.displayName || extension.name;
|
||||
const dependencyExtension = (await this._extensionsWorkbenchService.queryGallery({ names: [missingDependency] })).firstPage[0];
|
||||
if (dependencyExtension) {
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: localize('uninstalledDep', "Cannot activate extension '{0}' because it depends on extension '{1}', which is not installed. Would you like to install the extension and reload the window?", extName, dependencyExtension.displayName),
|
||||
actions: {
|
||||
primary: [new Action('install', localize('install missing dep', "Install and Reload"), '', true,
|
||||
() => this._extensionsWorkbenchService.install(dependencyExtension)
|
||||
.then(() => this._windowService.reloadWindow(), e => this._notificationService.error(e)))]
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this._notificationService.error(localize('unknownDep', "Cannot activate extension '{0}' because it depends on an unknown extension '{1}'.", extName, missingDependency));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,13 +8,12 @@ import Severity from 'vs/base/common/severity';
|
||||
import { Action, IAction } from 'vs/base/common/actions';
|
||||
import { MainThreadMessageServiceShape, MainContext, IExtHostContext, MainThreadMessageOptions } from '../node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { dispose } from 'vs/base/common/lifecycle';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
@extHostNamedCustomer(MainContext.MainThreadMessageService)
|
||||
export class MainThreadMessageService implements MainThreadMessageServiceShape {
|
||||
|
||||
@@ -42,12 +42,6 @@ namespace TaskExecutionDTO {
|
||||
task: TaskDTO.from(value.task)
|
||||
};
|
||||
}
|
||||
export function to(value: TaskExecutionDTO, workspace: IWorkspaceContextService, executeOnly: boolean): TaskExecution {
|
||||
return {
|
||||
id: value.id,
|
||||
task: TaskDTO.to(value.task, workspace, executeOnly)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace TaskProcessStartedDTO {
|
||||
@@ -143,7 +137,7 @@ namespace ProcessExecutionDTO {
|
||||
return candidate && !!candidate.process;
|
||||
}
|
||||
export function from(value: CommandConfiguration): ProcessExecutionDTO {
|
||||
const process: string = Types.isString(value.name) ? value.name : value.name.value;
|
||||
const process: string = Types.isString(value.name) ? value.name : value.name!.value;
|
||||
const args: string[] = value.args ? value.args.map(value => Types.isString(value) ? value : value.value) : [];
|
||||
const result: ProcessExecutionDTO = {
|
||||
process: process,
|
||||
@@ -347,8 +341,8 @@ namespace TaskDTO {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function to(task: TaskDTO, workspace: IWorkspaceContextService, executeOnly: boolean): ContributedTask | undefined {
|
||||
if (typeof task.name !== 'string') {
|
||||
export function to(task: TaskDTO | undefined, workspace: IWorkspaceContextService, executeOnly: boolean): ContributedTask | undefined {
|
||||
if (!task || (typeof task.name !== 'string')) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -370,7 +364,7 @@ namespace TaskDTO {
|
||||
const source = TaskSourceDTO.to(task.source, workspace);
|
||||
|
||||
const label = nls.localize('task.label', '{0}: {1}', source.label, task.name);
|
||||
const definition = TaskDefinitionDTO.to(task.definition, executeOnly);
|
||||
const definition = TaskDefinitionDTO.to(task.definition, executeOnly)!;
|
||||
const id = `${task.source.extensionId}.${definition._key}`;
|
||||
const result: ContributedTask = new ContributedTask(
|
||||
id, // uuidMap.getUUID(identifier)
|
||||
@@ -420,7 +414,7 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||
this._taskService.onDidStateChange((event: TaskEvent) => {
|
||||
const task = event.__task!;
|
||||
if (event.kind === TaskEventKind.Start) {
|
||||
this._proxy.$onDidStartTask(TaskExecutionDTO.from(task.getTaskExecution()), event.terminalId);
|
||||
this._proxy.$onDidStartTask(TaskExecutionDTO.from(task.getTaskExecution()), event.terminalId!);
|
||||
} else if (event.kind === TaskEventKind.ProcessStarted) {
|
||||
this._proxy.$onDidStartTaskProcess(TaskProcessStartedDTO.from(task.getTaskExecution(), event.processId!));
|
||||
} else if (event.kind === TaskEventKind.ProcessEnded) {
|
||||
@@ -439,9 +433,13 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||
}
|
||||
|
||||
$createTaskId(taskDTO: TaskDTO): Promise<string> {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let task = TaskDTO.to(taskDTO, this._workspaceContextServer, true);
|
||||
resolve(task._id);
|
||||
if (task) {
|
||||
resolve(task._id);
|
||||
} else {
|
||||
reject(new Error('Task could not be created from DTO'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -471,8 +469,11 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||
}
|
||||
|
||||
public $unregisterTaskProvider(handle: number): Promise<void> {
|
||||
this._providers.get(handle).disposable.dispose();
|
||||
this._providers.delete(handle);
|
||||
const provider = this._providers.get(handle);
|
||||
if (provider) {
|
||||
provider.disposable.dispose();
|
||||
this._providers.delete(handle);
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
@@ -493,20 +494,24 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||
return new Promise<TaskExecutionDTO>((resolve, reject) => {
|
||||
if (TaskHandleDTO.is(value)) {
|
||||
const workspaceFolder = this._workspaceContextServer.getWorkspaceFolder(URI.revive(value.workspaceFolder));
|
||||
this._taskService.getTask(workspaceFolder, value.id, true).then((task: Task) => {
|
||||
this._taskService.run(task).then(undefined, reason => {
|
||||
// eat the error, it has already been surfaced to the user and we don't care about it here
|
||||
if (workspaceFolder) {
|
||||
this._taskService.getTask(workspaceFolder, value.id, true).then((task: Task) => {
|
||||
this._taskService.run(task).then(undefined, reason => {
|
||||
// eat the error, it has already been surfaced to the user and we don't care about it here
|
||||
});
|
||||
const result: TaskExecutionDTO = {
|
||||
id: value.id,
|
||||
task: TaskDTO.from(task)
|
||||
};
|
||||
resolve(result);
|
||||
}, (_error) => {
|
||||
reject(new Error('Task not found'));
|
||||
});
|
||||
const result: TaskExecutionDTO = {
|
||||
id: value.id,
|
||||
task: TaskDTO.from(task)
|
||||
};
|
||||
resolve(result);
|
||||
}, (_error) => {
|
||||
reject(new Error('Task not found'));
|
||||
});
|
||||
} else {
|
||||
reject(new Error('No workspace folder'));
|
||||
}
|
||||
} else {
|
||||
const task = TaskDTO.to(value, this._workspaceContextServer, true);
|
||||
const task = TaskDTO.to(value, this._workspaceContextServer, true)!;
|
||||
this._taskService.run(task).then(undefined, reason => {
|
||||
// eat the error, it has already been surfaced to the user and we don't care about it here
|
||||
});
|
||||
|
||||
@@ -59,11 +59,11 @@ import { ExtHostUrls } from 'vs/workbench/api/node/extHostUrls';
|
||||
import { ExtHostWebviews } from 'vs/workbench/api/node/extHostWebview';
|
||||
import { ExtHostWindow } from 'vs/workbench/api/node/extHostWindow';
|
||||
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
import { IExtensionDescription, throwProposedApiError, checkProposedApiEnabled, nullExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { throwProposedApiError, checkProposedApiEnabled, nullExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ProxyIdentifier } from 'vs/workbench/services/extensions/node/proxyIdentifier';
|
||||
import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/node/extensionDescriptionRegistry';
|
||||
import * as vscode from 'vscode';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { originalFSPath } from 'vs/base/common/resources';
|
||||
import { CLIServer } from 'vs/workbench/api/node/extHostCLIServer';
|
||||
|
||||
@@ -699,8 +699,8 @@ export function createApiFactory(
|
||||
registerDebugAdapterTrackerFactory(debugType: string, factory: vscode.DebugAdapterTrackerFactory) {
|
||||
return extHostDebugService.registerDebugAdapterTrackerFactory(debugType, factory);
|
||||
},
|
||||
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration) {
|
||||
return extHostDebugService.startDebugging(folder, nameOrConfig);
|
||||
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration, parentSession?: vscode.DebugSession) {
|
||||
return extHostDebugService.startDebugging(folder, nameOrConfig, parentSession);
|
||||
},
|
||||
addBreakpoints(breakpoints: vscode.Breakpoint[]) {
|
||||
return extHostDebugService.addBreakpoints(breakpoints);
|
||||
|
||||
@@ -36,14 +36,14 @@ import { ITreeItem, IRevealOptions } from 'vs/workbench/common/views';
|
||||
import { IAdapterDescriptor, IConfig, ITerminalSettings } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { ITextQueryBuilderOptions } from 'vs/workbench/contrib/search/common/queryBuilder';
|
||||
import { ITerminalDimensions } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ExtensionActivationError } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IRPCProtocol, createExtHostContextProxyIdentifier as createExtId, createMainContextProxyIdentifier as createMainId } from 'vs/workbench/services/extensions/node/proxyIdentifier';
|
||||
import { IProgressOptions, IProgressStep } from 'vs/platform/progress/common/progress';
|
||||
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import * as vscode from 'vscode';
|
||||
import { IMarkdownString } from 'vs/base/common/htmlContent';
|
||||
import { ResolvedAuthority } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { IRemoteConsoleLog } from 'vs/base/node/console';
|
||||
import * as codeInset from 'vs/workbench/contrib/codeinset/common/codeInset';
|
||||
import * as callHierarchy from 'vs/workbench/contrib/callHierarchy/common/callHierarchy';
|
||||
@@ -61,7 +61,7 @@ export interface IEnvironment {
|
||||
export interface IStaticWorkspaceData {
|
||||
id: string;
|
||||
name: string;
|
||||
configuration?: UriComponents;
|
||||
configuration?: UriComponents | null;
|
||||
}
|
||||
|
||||
export interface IWorkspaceData extends IStaticWorkspaceData {
|
||||
@@ -72,7 +72,7 @@ export interface IInitData {
|
||||
commit?: string;
|
||||
parentPid: number;
|
||||
environment: IEnvironment;
|
||||
workspace?: IStaticWorkspaceData;
|
||||
workspace?: IStaticWorkspaceData | null;
|
||||
resolvedExtensions: ExtensionIdentifier[];
|
||||
hostExtensions: ExtensionIdentifier[];
|
||||
extensions: IExtensionDescription[];
|
||||
@@ -372,7 +372,7 @@ export interface MainThreadProgressShape extends IDisposable {
|
||||
}
|
||||
|
||||
export interface MainThreadTerminalServiceShape extends IDisposable {
|
||||
$createTerminal(name?: string, shellPath?: string, shellArgs?: string[], cwd?: string | UriComponents, env?: { [key: string]: string }, waitOnExit?: boolean, strictEnv?: boolean): Promise<{ id: number, name: string }>;
|
||||
$createTerminal(name?: string, shellPath?: string, shellArgs?: string[], cwd?: string | UriComponents, env?: { [key: string]: string | null }, waitOnExit?: boolean, strictEnv?: boolean): Promise<{ id: number, name: string }>;
|
||||
$createTerminalRenderer(name: string): Promise<number>;
|
||||
$dispose(terminalId: number): void;
|
||||
$hide(terminalId: number): void;
|
||||
@@ -573,11 +573,10 @@ export interface MainThreadTaskShape extends IDisposable {
|
||||
}
|
||||
|
||||
export interface MainThreadExtensionServiceShape extends IDisposable {
|
||||
$localShowMessage(severity: Severity, msg: string): void;
|
||||
$activateExtension(extensionId: ExtensionIdentifier, activationEvent: string | null): Promise<void>;
|
||||
$onWillActivateExtension(extensionId: ExtensionIdentifier): void;
|
||||
$onDidActivateExtension(extensionId: ExtensionIdentifier, startup: boolean, codeLoadingTime: number, activateCallTime: number, activateResolvedTime: number, activationEvent: string | null): void;
|
||||
$onExtensionActivationFailed(extensionId: ExtensionIdentifier): void;
|
||||
$onExtensionActivationError(extensionId: ExtensionIdentifier, error: ExtensionActivationError): Promise<void>;
|
||||
$onExtensionRuntimeError(extensionId: ExtensionIdentifier, error: SerializedError): void;
|
||||
}
|
||||
|
||||
@@ -641,15 +640,15 @@ export interface MainThreadDebugServiceShape extends IDisposable {
|
||||
$registerDebugTypes(debugTypes: string[]): void;
|
||||
$sessionCached(sessionID: string): void;
|
||||
$acceptDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void;
|
||||
$acceptDAError(handle: number, name: string, message: string, stack: string): void;
|
||||
$acceptDAExit(handle: number, code: number, signal: string): void;
|
||||
$acceptDAError(handle: number, name: string, message: string, stack: string | undefined): void;
|
||||
$acceptDAExit(handle: number, code: number | undefined, signal: string | undefined): void;
|
||||
$registerDebugConfigurationProvider(type: string, hasProvideMethod: boolean, hasResolveMethod: boolean, hasProvideDaMethod: boolean, handle: number): Promise<void>;
|
||||
$registerDebugAdapterDescriptorFactory(type: string, handle: number): Promise<void>;
|
||||
$registerDebugAdapterTrackerFactory(type: string, handle: number);
|
||||
$unregisterDebugConfigurationProvider(handle: number): void;
|
||||
$unregisterDebugAdapterDescriptorFactory(handle: number): void;
|
||||
$unregisterDebugAdapterTrackerFactory(handle: number): void;
|
||||
$startDebugging(folder: UriComponents | undefined, nameOrConfig: string | vscode.DebugConfiguration): Promise<boolean>;
|
||||
$startDebugging(folder: UriComponents | undefined, nameOrConfig: string | vscode.DebugConfiguration, parentSessionID: string | undefined): Promise<boolean>;
|
||||
$customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): Promise<any>;
|
||||
$appendDebugConsole(value: string): void;
|
||||
$startBreakpointEvents(): void;
|
||||
@@ -1067,7 +1066,7 @@ export interface ExtHostDebugServiceShape {
|
||||
$startDASession(handle: number, session: IDebugSessionDto): Promise<void>;
|
||||
$stopDASession(handle: number): Promise<void>;
|
||||
$sendDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void;
|
||||
$resolveDebugConfiguration(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig): Promise<IConfig>;
|
||||
$resolveDebugConfiguration(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig): Promise<IConfig | null | undefined>;
|
||||
$provideDebugConfigurations(handle: number, folder: UriComponents | undefined): Promise<IConfig[]>;
|
||||
$legacyDebugAdapterExecutable(handle: number, folderUri: UriComponents | undefined): Promise<IAdapterDescriptor>; // TODO@AW legacy
|
||||
$provideDebugAdapter(handle: number, session: IDebugSessionDto): Promise<IAdapterDescriptor>;
|
||||
|
||||
@@ -14,8 +14,7 @@ import { ExtHostCommentsShape, IMainContext, MainContext, MainThreadCommentsShap
|
||||
import { CommandsConverter, ExtHostCommands } from './extHostCommands';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
|
||||
interface HandlerData<T> {
|
||||
@@ -383,8 +382,6 @@ export class ExtHostCommentThread implements vscode.CommentThread {
|
||||
this._proxy.$updateCommentThreadLabel(this._commentController.handle, this.handle, this._label);
|
||||
}
|
||||
|
||||
private _comments: vscode.Comment[] = [];
|
||||
|
||||
get comments(): vscode.Comment[] {
|
||||
return this._comments;
|
||||
}
|
||||
@@ -435,7 +432,8 @@ export class ExtHostCommentThread implements vscode.CommentThread {
|
||||
private _commentController: ExtHostCommentController,
|
||||
private _threadId: string,
|
||||
private _resource: vscode.Uri,
|
||||
private _range: vscode.Range
|
||||
private _range: vscode.Range,
|
||||
private _comments: vscode.Comment[]
|
||||
) {
|
||||
this._proxy.$createCommentThread(
|
||||
this._commentController.handle,
|
||||
@@ -517,7 +515,7 @@ class ExtHostCommentController implements vscode.CommentController {
|
||||
|
||||
private _threads: Map<number, ExtHostCommentThread> = new Map<number, ExtHostCommentThread>();
|
||||
commentingRangeProvider?: vscode.CommentingRangeProvider;
|
||||
emptyCommentThreadFactory: vscode.EmptyCommentThreadFactory;
|
||||
emptyCommentThreadFactory?: vscode.EmptyCommentThreadFactory;
|
||||
|
||||
|
||||
private _commentReactionProvider?: vscode.CommentReactionProvider;
|
||||
@@ -544,8 +542,8 @@ class ExtHostCommentController implements vscode.CommentController {
|
||||
this._proxy.$registerCommentController(this.handle, _id, _label);
|
||||
}
|
||||
|
||||
createCommentThread(id: string, resource: vscode.Uri, range: vscode.Range): vscode.CommentThread {
|
||||
const commentThread = new ExtHostCommentThread(this._proxy, this._commandsConverter, this, id, resource, range);
|
||||
createCommentThread(id: string, resource: vscode.Uri, range: vscode.Range, comments: vscode.Comment[]): vscode.CommentThread {
|
||||
const commentThread = new ExtHostCommentThread(this._proxy, this._commandsConverter, this, id, resource, range, comments);
|
||||
this._threads.set(commentThread.handle, commentThread);
|
||||
return commentThread;
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/node/extensionDescriptionRegistry';
|
||||
|
||||
import { IProcessEnvironment } from 'vs/base/common/platform';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
|
||||
@@ -77,7 +77,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
|
||||
private _variableResolver: IConfigurationResolverService;
|
||||
|
||||
private _integratedTerminalInstance: vscode.Terminal;
|
||||
private _integratedTerminalInstance?: vscode.Terminal;
|
||||
private _terminalDisposedListener: IDisposable;
|
||||
|
||||
|
||||
@@ -241,8 +241,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
return this._debugServiceProxy.$unregisterBreakpoints(ids, fids);
|
||||
}
|
||||
|
||||
public startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration): Promise<boolean> {
|
||||
return this._debugServiceProxy.$startDebugging(folder ? folder.uri : undefined, nameOrConfig);
|
||||
public startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration, parentSession?: vscode.DebugSession): Promise<boolean> {
|
||||
return this._debugServiceProxy.$startDebugging(folder ? folder.uri : undefined, nameOrConfig, parentSession ? parentSession.id : undefined);
|
||||
}
|
||||
|
||||
public registerDebugConfigurationProvider(type: string, provider: vscode.DebugConfigurationProvider): vscode.Disposable {
|
||||
@@ -324,7 +324,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
// React on terminal disposed and check if that is the debug terminal #12956
|
||||
this._terminalDisposedListener = this._terminalService.onDidCloseTerminal(terminal => {
|
||||
if (this._integratedTerminalInstance && this._integratedTerminalInstance === terminal) {
|
||||
this._integratedTerminalInstance = null;
|
||||
this._integratedTerminalInstance = undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -341,16 +341,17 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
}
|
||||
}).then(needNewTerminal => {
|
||||
|
||||
if (needNewTerminal) {
|
||||
if (needNewTerminal || !this._integratedTerminalInstance) {
|
||||
this._integratedTerminalInstance = this._terminalService.createTerminal(args.title || nls.localize('debug.terminal.title', "debuggee"));
|
||||
}
|
||||
const terminal: vscode.Terminal = this._integratedTerminalInstance;
|
||||
|
||||
this._integratedTerminalInstance.show();
|
||||
terminal.show();
|
||||
|
||||
return this._integratedTerminalInstance.processId.then(shellProcessId => {
|
||||
|
||||
const command = prepareCommand(args, config);
|
||||
this._integratedTerminalInstance.sendText(command, true);
|
||||
terminal.sendText(command, true);
|
||||
|
||||
return shellProcessId;
|
||||
});
|
||||
@@ -363,13 +364,13 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
return terminalLauncher.runInTerminal(args, config);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
public async $substituteVariables(folderUri: UriComponents | undefined, config: IConfig): Promise<IConfig> {
|
||||
const [workspaceFolders, configProvider] = await Promise.all([this._workspaceService.getWorkspaceFolders2(), this._configurationService.getConfigProvider()]);
|
||||
if (!this._variableResolver) {
|
||||
this._variableResolver = new ExtHostVariableResolverService(workspaceFolders, this._editorsService, configProvider);
|
||||
const [workspaceFolders, configProvider] = await Promise.all([this._workspaceService.getWorkspaceFolders2(), this._configurationService.getConfigProvider()]);
|
||||
this._variableResolver = new ExtHostVariableResolverService(workspaceFolders || [], this._editorsService, configProvider);
|
||||
}
|
||||
let ws: IWorkspaceFolder | undefined;
|
||||
const folder = await this.getFolder(folderUri);
|
||||
@@ -390,9 +391,10 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
const mythis = this;
|
||||
|
||||
const session = await this.getSession(sessionDto);
|
||||
return this.getAdapterDescriptor(this.getAdapterFactoryByType(session.type), session).then(x => {
|
||||
|
||||
const adapter = this.convertToDto(x);
|
||||
return this.getAdapterDescriptor(this.getAdapterFactoryByType(session.type), session).then(daDescriptor => {
|
||||
|
||||
const adapter = this.convertToDto(daDescriptor);
|
||||
let da: AbstractDebugAdapter | undefined = undefined;
|
||||
|
||||
switch (adapter.type) {
|
||||
@@ -413,8 +415,10 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
break;
|
||||
}
|
||||
|
||||
if (da) {
|
||||
this._debugAdapters.set(debugAdapterHandle, da);
|
||||
const debugAdapter = da;
|
||||
|
||||
if (debugAdapter) {
|
||||
this._debugAdapters.set(debugAdapterHandle, debugAdapter);
|
||||
|
||||
return this.getDebugAdapterTrackers(session).then(tracker => {
|
||||
|
||||
@@ -422,9 +426,9 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
this._debugAdaptersTrackers.set(debugAdapterHandle, tracker);
|
||||
}
|
||||
|
||||
da.onMessage(message => {
|
||||
debugAdapter.onMessage(message => {
|
||||
|
||||
if (tracker) {
|
||||
if (tracker && tracker.onDidSendMessage) {
|
||||
tracker.onDidSendMessage(message);
|
||||
}
|
||||
|
||||
@@ -433,24 +437,24 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
|
||||
mythis._debugServiceProxy.$acceptDAMessage(debugAdapterHandle, message);
|
||||
});
|
||||
da.onError(err => {
|
||||
if (tracker) {
|
||||
debugAdapter.onError(err => {
|
||||
if (tracker && tracker.onError) {
|
||||
tracker.onError(err);
|
||||
}
|
||||
this._debugServiceProxy.$acceptDAError(debugAdapterHandle, err.name, err.message, err.stack);
|
||||
});
|
||||
da.onExit(code => {
|
||||
if (tracker) {
|
||||
debugAdapter.onExit((code: number) => {
|
||||
if (tracker && tracker.onExit) {
|
||||
tracker.onExit(code, undefined);
|
||||
}
|
||||
this._debugServiceProxy.$acceptDAExit(debugAdapterHandle, code, null);
|
||||
this._debugServiceProxy.$acceptDAExit(debugAdapterHandle, code, undefined);
|
||||
});
|
||||
|
||||
if (tracker) {
|
||||
if (tracker && tracker.onWillStartSession) {
|
||||
tracker.onWillStartSession();
|
||||
}
|
||||
|
||||
return da.startSession();
|
||||
return debugAdapter.startSession();
|
||||
});
|
||||
|
||||
}
|
||||
@@ -458,13 +462,13 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
});
|
||||
}
|
||||
|
||||
public $sendDAMessage(debugAdapterHandle: number, message: DebugProtocol.ProtocolMessage): Promise<void> {
|
||||
public $sendDAMessage(debugAdapterHandle: number, message: DebugProtocol.ProtocolMessage): void {
|
||||
|
||||
// VS Code -> DA
|
||||
message = convertToDAPaths(message, false);
|
||||
|
||||
const tracker = this._debugAdaptersTrackers.get(debugAdapterHandle); // TODO@AW: same handle?
|
||||
if (tracker) {
|
||||
if (tracker && tracker.onWillReceiveMessage) {
|
||||
tracker.onWillReceiveMessage(message);
|
||||
}
|
||||
|
||||
@@ -472,14 +476,13 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
if (da) {
|
||||
da.sendMessage(message);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $stopDASession(debugAdapterHandle: number): Promise<void> {
|
||||
|
||||
const tracker = this._debugAdaptersTrackers.get(debugAdapterHandle);
|
||||
this._debugAdaptersTrackers.delete(debugAdapterHandle);
|
||||
if (tracker) {
|
||||
if (tracker && tracker.onWillStopSession) {
|
||||
tracker.onWillStopSession();
|
||||
}
|
||||
|
||||
@@ -488,7 +491,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
if (da) {
|
||||
return da.stopSession();
|
||||
} else {
|
||||
return undefined;
|
||||
return Promise.resolve(void 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,8 +503,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
|
||||
if (delta.added) {
|
||||
for (const bpd of delta.added) {
|
||||
|
||||
if (!this._breakpoints.has(bpd.id)) {
|
||||
const id = bpd.id;
|
||||
if (id && !this._breakpoints.has(id)) {
|
||||
let bp: vscode.Breakpoint;
|
||||
if (bpd.type === 'function') {
|
||||
bp = new FunctionBreakpoint(bpd.functionName, bpd.enabled, bpd.condition, bpd.hitCondition, bpd.logMessage);
|
||||
@@ -509,8 +512,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
const uri = URI.revive(bpd.uri);
|
||||
bp = new SourceBreakpoint(new Location(uri, new Position(bpd.line, bpd.character)), bpd.enabled, bpd.condition, bpd.hitCondition, bpd.logMessage);
|
||||
}
|
||||
(bp as any)._id = bpd.id;
|
||||
this._breakpoints.set(bpd.id, bp);
|
||||
(bp as any)._id = id;
|
||||
this._breakpoints.set(id, bp);
|
||||
a.push(bp);
|
||||
}
|
||||
}
|
||||
@@ -528,24 +531,26 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
|
||||
if (delta.changed) {
|
||||
for (const bpd of delta.changed) {
|
||||
const bp = this._breakpoints.get(bpd.id);
|
||||
if (bp) {
|
||||
if (bp instanceof FunctionBreakpoint && bpd.type === 'function') {
|
||||
const fbp = <any>bp;
|
||||
fbp.enabled = bpd.enabled;
|
||||
fbp.condition = bpd.condition;
|
||||
fbp.hitCondition = bpd.hitCondition;
|
||||
fbp.logMessage = bpd.logMessage;
|
||||
fbp.functionName = bpd.functionName;
|
||||
} else if (bp instanceof SourceBreakpoint && bpd.type === 'source') {
|
||||
const sbp = <any>bp;
|
||||
sbp.enabled = bpd.enabled;
|
||||
sbp.condition = bpd.condition;
|
||||
sbp.hitCondition = bpd.hitCondition;
|
||||
sbp.logMessage = bpd.logMessage;
|
||||
sbp.location = new Location(URI.revive(bpd.uri), new Position(bpd.line, bpd.character));
|
||||
if (bpd.id) {
|
||||
const bp = this._breakpoints.get(bpd.id);
|
||||
if (bp) {
|
||||
if (bp instanceof FunctionBreakpoint && bpd.type === 'function') {
|
||||
const fbp = <any>bp;
|
||||
fbp.enabled = bpd.enabled;
|
||||
fbp.condition = bpd.condition;
|
||||
fbp.hitCondition = bpd.hitCondition;
|
||||
fbp.logMessage = bpd.logMessage;
|
||||
fbp.functionName = bpd.functionName;
|
||||
} else if (bp instanceof SourceBreakpoint && bpd.type === 'source') {
|
||||
const sbp = <any>bp;
|
||||
sbp.enabled = bpd.enabled;
|
||||
sbp.condition = bpd.condition;
|
||||
sbp.hitCondition = bpd.hitCondition;
|
||||
sbp.logMessage = bpd.logMessage;
|
||||
sbp.location = new Location(URI.revive(bpd.uri), new Position(bpd.line, bpd.character));
|
||||
}
|
||||
c.push(bp);
|
||||
}
|
||||
c.push(bp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -553,41 +558,57 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
this.fireBreakpointChanges(a, r, c);
|
||||
}
|
||||
|
||||
public async $provideDebugConfigurations(configProviderHandle: number, folderUri: UriComponents | undefined): Promise<vscode.DebugConfiguration[]> {
|
||||
const provider = this.getConfigProviderByHandle(configProviderHandle);
|
||||
if (!provider) {
|
||||
return Promise.reject(new Error('no handler found'));
|
||||
}
|
||||
if (!provider.provideDebugConfigurations) {
|
||||
return Promise.reject(new Error('handler has no method provideDebugConfigurations'));
|
||||
}
|
||||
const folder = await this.getFolder(folderUri);
|
||||
return asPromise(() => provider.provideDebugConfigurations(folder, CancellationToken.None));
|
||||
public $provideDebugConfigurations(configProviderHandle: number, folderUri: UriComponents | undefined): Promise<vscode.DebugConfiguration[]> {
|
||||
return asPromise(async () => {
|
||||
const provider = this.getConfigProviderByHandle(configProviderHandle);
|
||||
if (!provider) {
|
||||
throw new Error('no DebugConfigurationProvider found');
|
||||
}
|
||||
if (!provider.provideDebugConfigurations) {
|
||||
throw new Error('DebugConfigurationProvider has no method provideDebugConfigurations');
|
||||
}
|
||||
const folder = await this.getFolder(folderUri);
|
||||
return provider.provideDebugConfigurations(folder, CancellationToken.None);
|
||||
}).then(debugConfigurations => {
|
||||
if (!debugConfigurations) {
|
||||
throw new Error('nothing returned from DebugConfigurationProvider.provideDebugConfigurations');
|
||||
}
|
||||
return debugConfigurations;
|
||||
});
|
||||
}
|
||||
|
||||
public async $resolveDebugConfiguration(configProviderHandle: number, folderUri: UriComponents | undefined, debugConfiguration: vscode.DebugConfiguration): Promise<vscode.DebugConfiguration> {
|
||||
const provider = this.getConfigProviderByHandle(configProviderHandle);
|
||||
if (!provider) {
|
||||
return Promise.reject(new Error('no handler found'));
|
||||
}
|
||||
if (!provider.resolveDebugConfiguration) {
|
||||
return Promise.reject(new Error('handler has no method resolveDebugConfiguration'));
|
||||
}
|
||||
const folder = await this.getFolder(folderUri);
|
||||
return asPromise(() => provider.resolveDebugConfiguration(folder, debugConfiguration, CancellationToken.None));
|
||||
public $resolveDebugConfiguration(configProviderHandle: number, folderUri: UriComponents | undefined, debugConfiguration: vscode.DebugConfiguration): Promise<vscode.DebugConfiguration | null | undefined> {
|
||||
return asPromise(async () => {
|
||||
const provider = this.getConfigProviderByHandle(configProviderHandle);
|
||||
if (!provider) {
|
||||
throw new Error('no DebugConfigurationProvider found');
|
||||
}
|
||||
if (!provider.resolveDebugConfiguration) {
|
||||
throw new Error('DebugConfigurationProvider has no method resolveDebugConfiguration');
|
||||
}
|
||||
const folder = await this.getFolder(folderUri);
|
||||
return provider.resolveDebugConfiguration(folder, debugConfiguration, CancellationToken.None);
|
||||
});
|
||||
}
|
||||
|
||||
// TODO@AW legacy
|
||||
public async $legacyDebugAdapterExecutable(configProviderHandle: number, folderUri: UriComponents | undefined): Promise<IAdapterDescriptor> {
|
||||
const provider = this.getConfigProviderByHandle(configProviderHandle);
|
||||
if (!provider) {
|
||||
return Promise.reject(new Error('no handler found'));
|
||||
}
|
||||
if (!provider.debugAdapterExecutable) {
|
||||
return Promise.reject(new Error('handler has no method debugAdapterExecutable'));
|
||||
}
|
||||
const folder = await this.getFolder(folderUri);
|
||||
return asPromise(() => provider.debugAdapterExecutable(folder, CancellationToken.None)).then(x => this.convertToDto(x));
|
||||
// TODO@AW deprecated and legacy
|
||||
public $legacyDebugAdapterExecutable(configProviderHandle: number, folderUri: UriComponents | undefined): Promise<IAdapterDescriptor> {
|
||||
return asPromise(async () => {
|
||||
const provider = this.getConfigProviderByHandle(configProviderHandle);
|
||||
if (!provider) {
|
||||
throw new Error('no DebugConfigurationProvider found');
|
||||
}
|
||||
if (!provider.debugAdapterExecutable) {
|
||||
throw new Error('DebugConfigurationProvider has no method debugAdapterExecutable');
|
||||
}
|
||||
const folder = await this.getFolder(folderUri);
|
||||
return provider.debugAdapterExecutable(folder, CancellationToken.None);
|
||||
}).then(executable => {
|
||||
if (!executable) {
|
||||
throw new Error('nothing returned from DebugConfigurationProvider.debugAdapterExecutable');
|
||||
}
|
||||
return this.convertToDto(executable);
|
||||
});
|
||||
}
|
||||
|
||||
public async $provideDebugAdapter(adapterProviderHandle: number, sessionDto: IDebugSessionDto): Promise<IAdapterDescriptor> {
|
||||
@@ -629,7 +650,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
|
||||
// private & dto helpers
|
||||
|
||||
private convertToDto(x: vscode.DebugAdapterDescriptor): IAdapterDescriptor {
|
||||
private convertToDto(x: vscode.DebugAdapterDescriptor | undefined): IAdapterDescriptor {
|
||||
if (x instanceof DebugAdapterExecutable) {
|
||||
return <IDebugAdapterExecutable>{
|
||||
type: 'executable',
|
||||
@@ -649,11 +670,11 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
implementation: x.implementation
|
||||
};
|
||||
} else */ {
|
||||
throw new Error('unexpected type');
|
||||
throw new Error('convertToDto unexpected type');
|
||||
}
|
||||
}
|
||||
|
||||
private getAdapterFactoryByType(type: string): vscode.DebugAdapterDescriptorFactory {
|
||||
private getAdapterFactoryByType(type: string): vscode.DebugAdapterDescriptorFactory | undefined {
|
||||
const results = this._adapterFactories.filter(p => p.type === type);
|
||||
if (results.length > 0) {
|
||||
return results[0].factory;
|
||||
@@ -661,7 +682,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private getAdapterProviderByHandle(handle: number): vscode.DebugAdapterDescriptorFactory {
|
||||
private getAdapterProviderByHandle(handle: number): vscode.DebugAdapterDescriptorFactory | undefined {
|
||||
const results = this._adapterFactories.filter(p => p.handle === handle);
|
||||
if (results.length > 0) {
|
||||
return results[0].factory;
|
||||
@@ -669,7 +690,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private getConfigProviderByHandle(handle: number): vscode.DebugConfigurationProvider {
|
||||
private getConfigProviderByHandle(handle: number): vscode.DebugConfigurationProvider | undefined {
|
||||
const results = this._configProviders.filter(p => p.handle === handle);
|
||||
if (results.length > 0) {
|
||||
return results[0].provider;
|
||||
@@ -694,18 +715,18 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
return false;
|
||||
}
|
||||
|
||||
private getDebugAdapterTrackers(session: ExtHostDebugSession): Promise<vscode.DebugAdapterTracker> {
|
||||
private getDebugAdapterTrackers(session: ExtHostDebugSession): Promise<vscode.DebugAdapterTracker | undefined> {
|
||||
|
||||
const config = session.configuration;
|
||||
const type = config.type;
|
||||
|
||||
const promises = this._trackerFactories
|
||||
.filter(tuple => tuple.type === type || tuple.type === '*')
|
||||
.map(tuple => asPromise(() => tuple.factory.createDebugAdapterTracker(session)).then(p => p).catch(err => null));
|
||||
.map(tuple => asPromise<vscode.ProviderResult<vscode.DebugAdapterTracker>>(() => tuple.factory.createDebugAdapterTracker(session)).then(p => p, err => null));
|
||||
|
||||
return Promise.race([
|
||||
Promise.all(promises).then(trackers => {
|
||||
trackers = trackers.filter(t => t); // filter null
|
||||
Promise.all(promises).then(result => {
|
||||
const trackers = <vscode.DebugAdapterTracker[]>result.filter(t => !!t); // filter null
|
||||
if (trackers.length > 0) {
|
||||
return new MultiTracker(trackers);
|
||||
}
|
||||
@@ -723,7 +744,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
});
|
||||
}
|
||||
|
||||
private async getAdapterDescriptor(adapterProvider: vscode.DebugAdapterDescriptorFactory, session: ExtHostDebugSession): Promise<vscode.DebugAdapterDescriptor> {
|
||||
private async getAdapterDescriptor(adapterProvider: vscode.DebugAdapterDescriptorFactory | undefined, session: ExtHostDebugSession): Promise<vscode.DebugAdapterDescriptor | undefined> {
|
||||
|
||||
// a "debugServer" attribute in the launch config takes precedence
|
||||
const serverPort = session.configuration.debugServer;
|
||||
@@ -732,16 +753,25 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
}
|
||||
|
||||
// TODO@AW legacy
|
||||
const pairs = this._configProviders.filter(p => p.type === session.type);
|
||||
if (pairs.length > 0) {
|
||||
if (pairs[0].provider.debugAdapterExecutable) {
|
||||
return asPromise(() => pairs[0].provider.debugAdapterExecutable(session.workspaceFolder, CancellationToken.None));
|
||||
}
|
||||
const pair = this._configProviders.filter(p => p.type === session.type).pop();
|
||||
if (pair && pair.provider.debugAdapterExecutable) {
|
||||
const func = pair.provider.debugAdapterExecutable;
|
||||
return asPromise(() => func(session.workspaceFolder, CancellationToken.None)).then(executable => {
|
||||
if (executable) {
|
||||
return executable;
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
||||
if (adapterProvider) {
|
||||
const extensionRegistry = await this._extensionService.getExtensionRegistry();
|
||||
return asPromise(() => adapterProvider.createDebugAdapterDescriptor(session, this.daExecutableFromPackage(session, extensionRegistry)));
|
||||
return asPromise(() => adapterProvider.createDebugAdapterDescriptor(session, this.daExecutableFromPackage(session, extensionRegistry))).then(daDescriptor => {
|
||||
if (daDescriptor) {
|
||||
return daDescriptor;
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
||||
// try deprecated command based extension API "adapterExecutableCommand" to determine the executable
|
||||
@@ -788,7 +818,10 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
private async getSession(dto: IDebugSessionDto): Promise<ExtHostDebugSession> {
|
||||
if (dto) {
|
||||
if (typeof dto === 'string') {
|
||||
return this._debugSessions.get(dto);
|
||||
const ds = this._debugSessions.get(dto);
|
||||
if (ds) {
|
||||
return ds;
|
||||
}
|
||||
} else {
|
||||
let ds = this._debugSessions.get(dto.id);
|
||||
if (!ds) {
|
||||
@@ -800,7 +833,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
return ds;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
throw new Error('cannot find session');
|
||||
}
|
||||
|
||||
private getFolder(_folderUri: UriComponents | undefined): Promise<vscode.WorkspaceFolder | undefined> {
|
||||
@@ -808,7 +841,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
const folderURI = URI.revive(_folderUri);
|
||||
return this._workspaceService.resolveWorkspaceFolder(folderURI);
|
||||
}
|
||||
return undefined;
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -869,7 +902,7 @@ export class ExtHostVariableResolverService extends AbstractVariableResolverServ
|
||||
|
||||
constructor(folders: vscode.WorkspaceFolder[], editorService: ExtHostDocumentsAndEditors, configurationService: ExtHostConfigProvider) {
|
||||
super({
|
||||
getFolderUri: (folderName: string): URI => {
|
||||
getFolderUri: (folderName: string): URI | undefined => {
|
||||
const found = folders.filter(f => f.name === folderName);
|
||||
if (found && found.length > 0) {
|
||||
return found[0].uri;
|
||||
@@ -879,7 +912,7 @@ export class ExtHostVariableResolverService extends AbstractVariableResolverServ
|
||||
getWorkspaceFolderCount: (): number => {
|
||||
return folders.length;
|
||||
},
|
||||
getConfigurationValue: (folderUri: URI, section: string) => {
|
||||
getConfigurationValue: (folderUri: URI, section: string): string | undefined => {
|
||||
return configurationService.getConfiguration(undefined, folderUri).get<string>(section);
|
||||
},
|
||||
getExecPath: (): string | undefined => {
|
||||
@@ -902,14 +935,14 @@ export class ExtHostVariableResolverService extends AbstractVariableResolverServ
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
getLineNumber: (): string => {
|
||||
getLineNumber: (): string | undefined => {
|
||||
const activeEditor = editorService.activeEditor();
|
||||
if (activeEditor) {
|
||||
return String(activeEditor.selection.end.line + 1);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}, process.env);
|
||||
}, process.env as IProcessEnvironment);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import { ExtHostDocuments } from 'vs/workbench/api/node/extHostDocuments';
|
||||
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import * as vscode from 'vscode';
|
||||
import { LinkedList } from 'vs/base/common/linkedList';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
type Listener = [Function, any, IExtensionDescription];
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/node/extensionDescriptionRegistry';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionActivationError, MissingDependencyError } from 'vs/workbench/services/extensions/common/extensions';
|
||||
|
||||
const NO_OP_VOID_PROMISE = Promise.resolve<void>(undefined);
|
||||
|
||||
@@ -173,8 +173,7 @@ export class FailedExtension extends ActivatedExtension {
|
||||
}
|
||||
|
||||
export interface IExtensionsActivatorHost {
|
||||
showMessage(severity: Severity, message: string): void;
|
||||
|
||||
onExtensionActivationError(extensionId: ExtensionIdentifier, error: ExtensionActivationError): void;
|
||||
actualActivateExtension(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<ActivatedExtension>;
|
||||
}
|
||||
|
||||
@@ -283,7 +282,7 @@ export class ExtensionsActivator {
|
||||
|
||||
if (dep && dep.activationFailed) {
|
||||
// Error condition 2: a dependency has already failed activation
|
||||
this._host.showMessage(Severity.Error, nls.localize('failedDep1', "Cannot activate extension '{0}' because it depends on extension '{1}', which failed to activate.", currentExtension.displayName || currentExtension.identifier.value, depId));
|
||||
this._host.onExtensionActivationError(currentExtension.identifier, nls.localize('failedDep1', "Cannot activate extension '{0}' because it depends on extension '{1}', which failed to activate.", currentExtension.displayName || currentExtension.identifier.value, depId));
|
||||
const error = new Error(`Dependency ${depId} failed to activate`);
|
||||
(<any>error).detail = dep.activationFailedError;
|
||||
this._activatedExtensions.set(ExtensionIdentifier.toKey(currentExtension.identifier), new FailedExtension(error));
|
||||
@@ -306,7 +305,7 @@ export class ExtensionsActivator {
|
||||
}
|
||||
|
||||
// Error condition 1: unknown dependency
|
||||
this._host.showMessage(Severity.Error, nls.localize('unknownDep', "Cannot activate extension '{0}' because it depends on extension '{1}', which is not installed or disabled. Please install or enable '{1}' and reload the window.", currentExtension.displayName || currentExtension.identifier.value, depId));
|
||||
this._host.onExtensionActivationError(currentExtension.identifier, new MissingDependencyError(depId));
|
||||
const error = new Error(`Unknown dependency '${depId}'`);
|
||||
this._activatedExtensions.set(ExtensionIdentifier.toKey(currentExtension.identifier), new FailedExtension(error));
|
||||
return;
|
||||
@@ -373,7 +372,7 @@ export class ExtensionsActivator {
|
||||
}
|
||||
|
||||
const newlyActivatingExtension = this._host.actualActivateExtension(extensionId, reason).then(undefined, (err) => {
|
||||
this._host.showMessage(Severity.Error, nls.localize('activationError', "Activating extension '{0}' failed: {1}.", extensionId.value, err.message));
|
||||
this._host.onExtensionActivationError(extensionId, nls.localize('activationError', "Activating extension '{0}' failed: {1}.", extensionId.value, err.message));
|
||||
console.error('Activating extension `' + extensionId.value + '` failed: ', err.message);
|
||||
console.log('Here is the error stack: ', err.stack);
|
||||
// Treat the extension as being empty
|
||||
|
||||
@@ -9,7 +9,6 @@ import { originalFSPath } from 'vs/base/common/resources';
|
||||
import { Barrier } from 'vs/base/common/async';
|
||||
import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { TernarySearchTree } from 'vs/base/common/map';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
@@ -20,14 +19,14 @@ import { ActivatedExtension, EmptyExtension, ExtensionActivatedByAPI, ExtensionA
|
||||
import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService';
|
||||
import { ExtHostStorage } from 'vs/workbench/api/node/extHostStorage';
|
||||
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ExtensionActivationError } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/node/extensionDescriptionRegistry';
|
||||
import { connectProxyResolver } from 'vs/workbench/services/extensions/node/proxyResolver';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import { ResolvedAuthority } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||
import * as vscode from 'vscode';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { IWorkspace } from 'vs/platform/workspace/common/workspace';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
|
||||
@@ -208,19 +207,8 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
initData.hostExtensions.forEach((extensionId) => hostExtensions.add(ExtensionIdentifier.toKey(extensionId)));
|
||||
|
||||
this._activator = new ExtensionsActivator(this._registry, initData.resolvedExtensions, initData.hostExtensions, {
|
||||
showMessage: (severity: Severity, message: string): void => {
|
||||
this._mainThreadExtensionsProxy.$localShowMessage(severity, message);
|
||||
|
||||
switch (severity) {
|
||||
case Severity.Error:
|
||||
console.error(message);
|
||||
break;
|
||||
case Severity.Warning:
|
||||
console.warn(message);
|
||||
break;
|
||||
default:
|
||||
console.log(message);
|
||||
}
|
||||
onExtensionActivationError: (extensionId: ExtensionIdentifier, error: ExtensionActivationError): void => {
|
||||
this._mainThreadExtensionsProxy.$onExtensionActivationError(extensionId, error);
|
||||
},
|
||||
|
||||
actualActivateExtension: async (extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<ActivatedExtension> => {
|
||||
@@ -383,7 +371,6 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
this._logExtensionActivationTimes(extensionDescription, reason, 'success', activationTimes);
|
||||
return activatedExtension;
|
||||
}, (err) => {
|
||||
this._mainThreadExtensionsProxy.$onExtensionActivationFailed(extensionDescription.identifier);
|
||||
this._logExtensionActivationTimes(extensionDescription, reason, 'failure');
|
||||
throw err;
|
||||
});
|
||||
|
||||
@@ -8,11 +8,11 @@ import { AsyncEmitter, Emitter, Event } from 'vs/base/common/event';
|
||||
import { IRelativePattern, parse } from 'vs/base/common/glob';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/node/extHostDocumentsAndEditors';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import * as vscode from 'vscode';
|
||||
import { ExtHostFileSystemEventServiceShape, FileSystemEvents, IMainContext, MainContext, ResourceFileEditDto, ResourceTextEditDto, MainThreadTextEditorsShape } from './extHost.protocol';
|
||||
import * as typeConverter from './extHostTypeConverters';
|
||||
import { Disposable, WorkspaceEdit } from './extHostTypes';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
class FileSystemWatcher implements vscode.FileSystemWatcher {
|
||||
|
||||
|
||||
@@ -22,10 +22,9 @@ import { IRange, Range as EditorRange } from 'vs/editor/common/core/range';
|
||||
import { isFalsyOrEmpty, isNonEmptyArray, coalesce } from 'vs/base/common/arrays';
|
||||
import { isObject } from 'vs/base/common/types';
|
||||
import { ISelection, Selection } from 'vs/editor/common/core/selection';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtHostWebview } from 'vs/workbench/api/node/extHostWebview';
|
||||
import * as codeInset from 'vs/workbench/contrib/codeinset/common/codeInset';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import * as vscode from 'vscode';
|
||||
import { MainContext, MainThreadMessageServiceShape, MainThreadMessageOptions, IMainContext } from './extHost.protocol';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
function isMessageItem(item: any): item is vscode.MessageItem {
|
||||
return item && item.title;
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
import { ProgressOptions } from 'vscode';
|
||||
import { MainThreadProgressShape, ExtHostProgressShape } from './extHost.protocol';
|
||||
import { ProgressLocation } from './extHostTypeConverters';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { Progress, IProgressStep } from 'vs/platform/progress/common/progress';
|
||||
import { localize } from 'vs/nls';
|
||||
import { CancellationTokenSource, CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { debounce } from 'vs/base/common/decorators';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
export class ExtHostProgress implements ExtHostProgressShape {
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { debounce } from 'vs/base/common/decorators';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { asPromise } from 'vs/base/common/async';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
|
||||
import { MainContext, MainThreadSCMShape, SCMRawResource, SCMRawResourceSplice, SCMRawResourceSplices, IMainContext, ExtHostSCMShape, CommandDto } from './extHost.protocol';
|
||||
import { sortedDiff } from 'vs/base/common/arrays';
|
||||
@@ -17,7 +16,7 @@ import * as vscode from 'vscode';
|
||||
import { ISplice } from 'vs/base/common/sequence';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
type ProviderHandle = number;
|
||||
type GroupHandle = number;
|
||||
|
||||
@@ -11,7 +11,6 @@ import { asPromise } from 'vs/base/common/async';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { win32 } from 'vs/base/node/processes';
|
||||
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
|
||||
import { MainContext, MainThreadTaskShape, ExtHostTaskShape, IMainContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
|
||||
@@ -32,15 +31,16 @@ import { ExtHostTerminalService, ExtHostTerminal } from 'vs/workbench/api/node/e
|
||||
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
namespace TaskDefinitionDTO {
|
||||
export function from(value: vscode.TaskDefinition): TaskDefinitionDTO {
|
||||
export function from(value: vscode.TaskDefinition): TaskDefinitionDTO | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
export function to(value: TaskDefinitionDTO): vscode.TaskDefinition {
|
||||
export function to(value: TaskDefinitionDTO): vscode.TaskDefinition | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -49,13 +49,13 @@ namespace TaskDefinitionDTO {
|
||||
}
|
||||
|
||||
namespace TaskPresentationOptionsDTO {
|
||||
export function from(value: vscode.TaskPresentationOptions): TaskPresentationOptionsDTO {
|
||||
export function from(value: vscode.TaskPresentationOptions): TaskPresentationOptionsDTO | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
export function to(value: TaskPresentationOptionsDTO): vscode.TaskPresentationOptions {
|
||||
export function to(value: TaskPresentationOptionsDTO): vscode.TaskPresentationOptions | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -64,13 +64,13 @@ namespace TaskPresentationOptionsDTO {
|
||||
}
|
||||
|
||||
namespace ProcessExecutionOptionsDTO {
|
||||
export function from(value: vscode.ProcessExecutionOptions): ProcessExecutionOptionsDTO {
|
||||
export function from(value: vscode.ProcessExecutionOptions): ProcessExecutionOptionsDTO | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
export function to(value: ProcessExecutionOptionsDTO): vscode.ProcessExecutionOptions {
|
||||
export function to(value: ProcessExecutionOptionsDTO): vscode.ProcessExecutionOptions | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -79,11 +79,15 @@ namespace ProcessExecutionOptionsDTO {
|
||||
}
|
||||
|
||||
namespace ProcessExecutionDTO {
|
||||
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ProcessExecutionDTO {
|
||||
const candidate = value as ProcessExecutionDTO;
|
||||
return candidate && !!candidate.process;
|
||||
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | undefined): value is ProcessExecutionDTO {
|
||||
if (value) {
|
||||
const candidate = value as ProcessExecutionDTO;
|
||||
return candidate && !!candidate.process;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export function from(value: vscode.ProcessExecution): ProcessExecutionDTO {
|
||||
export function from(value: vscode.ProcessExecution): ProcessExecutionDTO | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -96,7 +100,7 @@ namespace ProcessExecutionDTO {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export function to(value: ProcessExecutionDTO): types.ProcessExecution {
|
||||
export function to(value: ProcessExecutionDTO): types.ProcessExecution | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -105,13 +109,13 @@ namespace ProcessExecutionDTO {
|
||||
}
|
||||
|
||||
namespace ShellExecutionOptionsDTO {
|
||||
export function from(value: vscode.ShellExecutionOptions): ShellExecutionOptionsDTO {
|
||||
export function from(value: vscode.ShellExecutionOptions): ShellExecutionOptionsDTO | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
export function to(value: ShellExecutionOptionsDTO): vscode.ShellExecutionOptions {
|
||||
export function to(value: ShellExecutionOptionsDTO): vscode.ShellExecutionOptions | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -120,11 +124,15 @@ namespace ShellExecutionOptionsDTO {
|
||||
}
|
||||
|
||||
namespace ShellExecutionDTO {
|
||||
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ShellExecutionDTO {
|
||||
const candidate = value as ShellExecutionDTO;
|
||||
return candidate && (!!candidate.commandLine || !!candidate.command);
|
||||
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | undefined): value is ShellExecutionDTO {
|
||||
if (value) {
|
||||
const candidate = value as ShellExecutionDTO;
|
||||
return candidate && (!!candidate.commandLine || !!candidate.command);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export function from(value: vscode.ShellExecution): ShellExecutionDTO {
|
||||
export function from(value: vscode.ShellExecution): ShellExecutionDTO | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -141,22 +149,26 @@ namespace ShellExecutionDTO {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export function to(value: ShellExecutionDTO): types.ShellExecution {
|
||||
if (value === undefined || value === null) {
|
||||
export function to(value: ShellExecutionDTO): types.ShellExecution | undefined {
|
||||
if (value === undefined || value === null || (value.command === undefined && value.commandLine === undefined)) {
|
||||
return undefined;
|
||||
}
|
||||
if (value.commandLine) {
|
||||
return new types.ShellExecution(value.commandLine, value.options);
|
||||
} else {
|
||||
return new types.ShellExecution(value.command, value.args ? value.args : [], value.options);
|
||||
return new types.ShellExecution(value.command!, value.args ? value.args : [], value.options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace CustomExecutionDTO {
|
||||
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is CustomExecutionDTO {
|
||||
let candidate = value as CustomExecutionDTO;
|
||||
return candidate && candidate.customExecution === 'customExecution';
|
||||
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | undefined): value is CustomExecutionDTO {
|
||||
if (value) {
|
||||
let candidate = value as CustomExecutionDTO;
|
||||
return candidate && candidate.customExecution === 'customExecution';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function from(value: vscode.CustomExecution): CustomExecutionDTO {
|
||||
@@ -173,8 +185,8 @@ namespace TaskHandleDTO {
|
||||
folder = value.scope.uri;
|
||||
}
|
||||
return {
|
||||
id: value._id,
|
||||
workspaceFolder: folder
|
||||
id: value._id!,
|
||||
workspaceFolder: folder!
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -195,7 +207,7 @@ namespace TaskDTO {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function from(value: vscode.Task, extension: IExtensionDescription): TaskDTO {
|
||||
export function from(value: vscode.Task, extension: IExtensionDescription): TaskDTO | undefined {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -207,7 +219,7 @@ namespace TaskDTO {
|
||||
} else if ((<vscode.Task2>value).execution2 && (<vscode.Task2>value).execution2 instanceof types.CustomExecution) {
|
||||
execution = CustomExecutionDTO.from(<types.CustomExecution>(<vscode.Task2>value).execution2);
|
||||
}
|
||||
const definition: TaskDefinitionDTO = TaskDefinitionDTO.from(value.definition);
|
||||
const definition: TaskDefinitionDTO | undefined = TaskDefinitionDTO.from(value.definition);
|
||||
let scope: number | UriComponents;
|
||||
if (value.scope) {
|
||||
if (typeof value.scope === 'number') {
|
||||
@@ -224,7 +236,7 @@ namespace TaskDTO {
|
||||
}
|
||||
const group = (value.group as types.TaskGroup) ? (value.group as types.TaskGroup).id : undefined;
|
||||
const result: TaskDTO = {
|
||||
_id: (value as types.Task)._id,
|
||||
_id: (value as types.Task)._id!,
|
||||
definition,
|
||||
name: value.name,
|
||||
source: {
|
||||
@@ -232,7 +244,7 @@ namespace TaskDTO {
|
||||
label: value.source,
|
||||
scope: scope
|
||||
},
|
||||
execution,
|
||||
execution: execution!,
|
||||
isBackground: value.isBackground,
|
||||
group: group,
|
||||
presentationOptions: TaskPresentationOptionsDTO.from(value.presentationOptions),
|
||||
@@ -242,7 +254,7 @@ namespace TaskDTO {
|
||||
};
|
||||
return result;
|
||||
}
|
||||
export async function to(value: TaskDTO, workspace: IExtHostWorkspaceProvider): Promise<types.Task> {
|
||||
export async function to(value: TaskDTO | undefined, workspace: IExtHostWorkspaceProvider): Promise<types.Task | undefined> {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -252,7 +264,7 @@ namespace TaskDTO {
|
||||
} else if (ShellExecutionDTO.is(value.execution)) {
|
||||
execution = ShellExecutionDTO.to(value.execution);
|
||||
}
|
||||
const definition: vscode.TaskDefinition = TaskDefinitionDTO.to(value.definition);
|
||||
const definition: vscode.TaskDefinition | undefined = TaskDefinitionDTO.to(value.definition);
|
||||
let scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder | undefined;
|
||||
if (value.source) {
|
||||
if (value.source.scope !== undefined) {
|
||||
@@ -268,7 +280,7 @@ namespace TaskDTO {
|
||||
if (!definition || !scope) {
|
||||
return undefined;
|
||||
}
|
||||
const result = new types.Task(definition, scope, value.name, value.source.label, execution, value.problemMatchers);
|
||||
const result = new types.Task(definition, scope, value.name!, value.source.label, execution, value.problemMatchers);
|
||||
if (value.isBackground !== undefined) {
|
||||
result.isBackground = value.isBackground;
|
||||
}
|
||||
@@ -276,7 +288,7 @@ namespace TaskDTO {
|
||||
result.group = types.TaskGroup.from(value.group);
|
||||
}
|
||||
if (value.presentationOptions) {
|
||||
result.presentationOptions = TaskPresentationOptionsDTO.to(value.presentationOptions);
|
||||
result.presentationOptions = TaskPresentationOptionsDTO.to(value.presentationOptions)!;
|
||||
}
|
||||
if (value._id) {
|
||||
result._id = value._id;
|
||||
@@ -286,11 +298,11 @@ namespace TaskDTO {
|
||||
}
|
||||
|
||||
namespace TaskFilterDTO {
|
||||
export function from(value: vscode.TaskFilter): TaskFilterDTO {
|
||||
export function from(value: vscode.TaskFilter | undefined): TaskFilterDTO | undefined {
|
||||
return value;
|
||||
}
|
||||
|
||||
export function to(value: TaskFilterDTO): vscode.TaskFilter {
|
||||
export function to(value: TaskFilterDTO): vscode.TaskFilter | undefined {
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -320,7 +332,11 @@ class TaskExecutionImpl implements vscode.TaskExecution {
|
||||
|
||||
namespace TaskExecutionDTO {
|
||||
export async function to(value: TaskExecutionDTO, tasks: ExtHostTask, workspaceProvider: IExtHostWorkspaceProvider): Promise<vscode.TaskExecution> {
|
||||
return new TaskExecutionImpl(tasks, value.id, await TaskDTO.to(value.task, workspaceProvider));
|
||||
const task = await TaskDTO.to(value.task, workspaceProvider);
|
||||
if (!task) {
|
||||
throw new Error('Unexpected: Task cannot be created.');
|
||||
}
|
||||
return new TaskExecutionImpl(tasks, value.id, task);
|
||||
}
|
||||
export function from(value: vscode.TaskExecution): TaskExecutionDTO {
|
||||
return {
|
||||
@@ -358,7 +374,7 @@ class CustomExecutionData implements IDisposable {
|
||||
}
|
||||
|
||||
private onDidCloseTerminal(terminal: vscode.Terminal): void {
|
||||
if (this.terminal === terminal) {
|
||||
if ((this.terminal === terminal) && this._cancellationSource) {
|
||||
this._cancellationSource.cancel();
|
||||
}
|
||||
}
|
||||
@@ -624,27 +640,30 @@ export class ExtHostTask implements ExtHostTaskShape {
|
||||
const taskIdPromises: Promise<void>[] = [];
|
||||
const fetchPromise = asPromise(() => handler.provider.provideTasks(CancellationToken.None)).then(value => {
|
||||
const taskDTOs: TaskDTO[] = [];
|
||||
for (let task of value) {
|
||||
if (!task.definition || !validTypes[task.definition.type]) {
|
||||
console.warn(`The task [${task.source}, ${task.name}] uses an undefined task type. The task will be ignored in the future.`);
|
||||
}
|
||||
if (value) {
|
||||
for (let task of value) {
|
||||
if (!task.definition || !validTypes[task.definition.type]) {
|
||||
console.warn(`The task [${task.source}, ${task.name}] uses an undefined task type. The task will be ignored in the future.`);
|
||||
}
|
||||
|
||||
const taskDTO: TaskDTO = TaskDTO.from(task, handler.extension);
|
||||
taskDTOs.push(taskDTO);
|
||||
const taskDTO: TaskDTO | undefined = TaskDTO.from(task, handler.extension);
|
||||
if (taskDTO) {
|
||||
taskDTOs.push(taskDTO);
|
||||
|
||||
if (CustomExecutionDTO.is(taskDTO.execution)) {
|
||||
taskIdPromises.push(new Promise((resolve) => {
|
||||
// The ID is calculated on the main thread task side, so, let's call into it here.
|
||||
// We need the task id's pre-computed for custom task executions because when OnDidStartTask
|
||||
// is invoked, we have to be able to map it back to our data.
|
||||
this._proxy.$createTaskId(taskDTO).then((taskId) => {
|
||||
this._providedCustomExecutions.set(taskId, new CustomExecutionData(<vscode.CustomExecution>(<vscode.Task2>task).execution2, this._terminalService));
|
||||
resolve();
|
||||
});
|
||||
}));
|
||||
if (CustomExecutionDTO.is(taskDTO.execution)) {
|
||||
taskIdPromises.push(new Promise((resolve) => {
|
||||
// The ID is calculated on the main thread task side, so, let's call into it here.
|
||||
// We need the task id's pre-computed for custom task executions because when OnDidStartTask
|
||||
// is invoked, we have to be able to map it back to our data.
|
||||
this._proxy.$createTaskId(taskDTO).then((taskId) => {
|
||||
this._providedCustomExecutions.set(taskId, new CustomExecutionData(<vscode.CustomExecution>(<vscode.Task2>task).execution2, this._terminalService));
|
||||
resolve();
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
tasks: taskDTOs,
|
||||
extension: handler.extension
|
||||
@@ -664,11 +683,14 @@ export class ExtHostTask implements ExtHostTaskShape {
|
||||
const configProvider = await this._configurationService.getConfigProvider();
|
||||
const uri: URI = URI.revive(uriComponents);
|
||||
const result = {
|
||||
process: undefined as string,
|
||||
process: <unknown>undefined as string,
|
||||
variables: Object.create(null)
|
||||
};
|
||||
const workspaceFolder = await this._workspaceProvider.resolveWorkspaceFolder(uri);
|
||||
const workspaceFolders = await this._workspaceProvider.getWorkspaceFolders2();
|
||||
if (!workspaceFolders || !workspaceFolder) {
|
||||
throw new Error('Unexpected: Tasks can only be run in a workspace folder');
|
||||
}
|
||||
const resolver = new ExtHostVariableResolverService(workspaceFolders, this._editorService, configProvider);
|
||||
const ws: IWorkspaceFolder = {
|
||||
uri: workspaceFolder.uri,
|
||||
@@ -704,16 +726,24 @@ export class ExtHostTask implements ExtHostTaskShape {
|
||||
|
||||
private async getTaskExecution(execution: TaskExecutionDTO | string, task?: vscode.Task): Promise<TaskExecutionImpl> {
|
||||
if (typeof execution === 'string') {
|
||||
return this._taskExecutions.get(execution);
|
||||
const taskExecution = this._taskExecutions.get(execution);
|
||||
if (!taskExecution) {
|
||||
throw new Error('Unexpected: The specified task is missing an execution');
|
||||
}
|
||||
return taskExecution;
|
||||
}
|
||||
|
||||
let result: TaskExecutionImpl = this._taskExecutions.get(execution.id);
|
||||
let result: TaskExecutionImpl | undefined = this._taskExecutions.get(execution.id);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
result = new TaskExecutionImpl(this, execution.id, task ? task : await TaskDTO.to(execution.task, this._workspaceProvider));
|
||||
this._taskExecutions.set(execution.id, result);
|
||||
return result;
|
||||
const taskToCreate = task ? task : await TaskDTO.to(execution.task, this._workspaceProvider);
|
||||
if (!taskToCreate) {
|
||||
throw new Error('Unexpected: Task does not exist.');
|
||||
}
|
||||
const createdResult: TaskExecutionImpl = new TaskExecutionImpl(this, execution.id, taskToCreate);
|
||||
this._taskExecutions.set(execution.id, createdResult);
|
||||
return createdResult;
|
||||
}
|
||||
|
||||
private customExecutionComplete(execution: TaskExecutionDTO): void {
|
||||
|
||||
@@ -74,9 +74,9 @@ export class BaseExtHostTerminal {
|
||||
}
|
||||
|
||||
export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Terminal {
|
||||
private _pidPromise: Promise<number>;
|
||||
private _pidPromiseComplete: (value: number) => any;
|
||||
private _pidPromise: Promise<number | undefined>;
|
||||
private _cols: number | undefined;
|
||||
private _pidPromiseComplete: ((value: number | undefined) => any) | null;
|
||||
private _rows: number | undefined;
|
||||
|
||||
private readonly _onData = new Emitter<string>();
|
||||
@@ -90,7 +90,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
|
||||
|
||||
constructor(
|
||||
proxy: MainThreadTerminalServiceShape,
|
||||
private _name: string,
|
||||
private _name?: string,
|
||||
id?: number,
|
||||
pid?: number
|
||||
) {
|
||||
@@ -108,7 +108,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
|
||||
shellPath?: string,
|
||||
shellArgs?: string[],
|
||||
cwd?: string | URI,
|
||||
env?: { [key: string]: string },
|
||||
env?: { [key: string]: string | null },
|
||||
waitOnExit?: boolean,
|
||||
strictEnv?: boolean
|
||||
): void {
|
||||
@@ -119,7 +119,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
|
||||
}
|
||||
|
||||
public get name(): string {
|
||||
return this._name;
|
||||
return this._name || '';
|
||||
}
|
||||
|
||||
public set name(name: string) {
|
||||
@@ -127,7 +127,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
|
||||
}
|
||||
|
||||
public get dimensions(): vscode.TerminalDimensions | undefined {
|
||||
if (this._cols === undefined && this._rows === undefined) {
|
||||
if (this._cols === undefined || this._rows === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
@@ -146,7 +146,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
|
||||
return true;
|
||||
}
|
||||
|
||||
public get processId(): Promise<number> {
|
||||
public get processId(): Promise<number | undefined> {
|
||||
return this._pidPromise;
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
|
||||
this._queueApiRequest(this._proxy.$hide, []);
|
||||
}
|
||||
|
||||
public _setProcessId(processId: number): void {
|
||||
public _setProcessId(processId: number | undefined): void {
|
||||
// The event may fire 2 times when the panel is restored
|
||||
if (this._pidPromiseComplete) {
|
||||
this._pidPromiseComplete(processId);
|
||||
@@ -203,15 +203,15 @@ export class ExtHostTerminalRenderer extends BaseExtHostTerminal implements vsco
|
||||
}
|
||||
|
||||
private _dimensions: vscode.TerminalDimensions | undefined;
|
||||
public get dimensions(): vscode.TerminalDimensions { return this._dimensions; }
|
||||
public set dimensions(dimensions: vscode.TerminalDimensions) {
|
||||
public get dimensions(): vscode.TerminalDimensions | undefined { return this._dimensions; }
|
||||
public set dimensions(dimensions: vscode.TerminalDimensions | undefined) {
|
||||
this._checkDisposed();
|
||||
this._dimensions = dimensions;
|
||||
this._queueApiRequest(this._proxy.$terminalRendererSetDimensions, [dimensions]);
|
||||
}
|
||||
|
||||
private _maximumDimensions: vscode.TerminalDimensions;
|
||||
public get maximumDimensions(): vscode.TerminalDimensions {
|
||||
private _maximumDimensions: vscode.TerminalDimensions | undefined;
|
||||
public get maximumDimensions(): vscode.TerminalDimensions | undefined {
|
||||
if (!this._maximumDimensions) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -259,20 +259,21 @@ export class ExtHostTerminalRenderer extends BaseExtHostTerminal implements vsco
|
||||
if (this._maximumDimensions && this._maximumDimensions.columns === columns && this._maximumDimensions.rows === rows) {
|
||||
return;
|
||||
}
|
||||
this._maximumDimensions = { columns, rows };
|
||||
this._onDidChangeMaximumDimensions.fire(this.maximumDimensions);
|
||||
const newValue = { columns, rows };
|
||||
this._maximumDimensions = newValue;
|
||||
this._onDidChangeMaximumDimensions.fire(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
private _proxy: MainThreadTerminalServiceShape;
|
||||
private _activeTerminal: ExtHostTerminal;
|
||||
private _activeTerminal: ExtHostTerminal | undefined;
|
||||
private _terminals: ExtHostTerminal[] = [];
|
||||
private _terminalProcesses: { [id: number]: TerminalProcess } = {};
|
||||
private _terminalRenderers: ExtHostTerminalRenderer[] = [];
|
||||
private _getTerminalPromises: { [id: number]: Promise<ExtHostTerminal> } = {};
|
||||
|
||||
public get activeTerminal(): ExtHostTerminal { return this._activeTerminal; }
|
||||
public get activeTerminal(): ExtHostTerminal | undefined { return this._activeTerminal; }
|
||||
public get terminals(): ExtHostTerminal[] { return this._terminals; }
|
||||
|
||||
private readonly _onDidCloseTerminal: Emitter<vscode.Terminal> = new Emitter<vscode.Terminal>();
|
||||
@@ -326,6 +327,9 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
}
|
||||
|
||||
const terminal = this._getTerminalById(id);
|
||||
if (!terminal) {
|
||||
throw new Error(`Cannot resolve terminal renderer for terminal id ${id}`);
|
||||
}
|
||||
const renderer = new ExtHostTerminalRenderer(this._proxy, terminal.name, terminal, terminal._id);
|
||||
this._terminalRenderers.push(renderer);
|
||||
|
||||
@@ -339,6 +343,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
if (original !== this._activeTerminal) {
|
||||
this._onDidChangeActiveTerminal.fire(this._activeTerminal);
|
||||
}
|
||||
return;
|
||||
}
|
||||
this._performTerminalIdAction(id, terminal => {
|
||||
if (terminal) {
|
||||
@@ -364,7 +369,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
if (terminal.setDimensions(cols, rows)) {
|
||||
this._onDidChangeTerminalDimensions.fire({
|
||||
terminal: terminal,
|
||||
dimensions: terminal.dimensions
|
||||
dimensions: terminal.dimensions as vscode.TerminalDimensions
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -449,8 +454,8 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
// this._configHelper.mergeDefaultShellPathAndArgs(shellLaunchConfig);
|
||||
|
||||
const platformKey = platform.isWindows ? 'windows' : platform.isMacintosh ? 'osx' : 'linux';
|
||||
const shellConfigValue: string = terminalConfig.get(`shell.${platformKey}`);
|
||||
const shellArgsConfigValue: string = terminalConfig.get(`shellArgs.${platformKey}`);
|
||||
const shellConfigValue: string | undefined = terminalConfig.get(`shell.${platformKey}`);
|
||||
const shellArgsConfigValue: string | undefined = terminalConfig.get(`shellArgs.${platformKey}`);
|
||||
|
||||
shellLaunchConfig.executable = shellConfigValue;
|
||||
shellLaunchConfig.args = shellArgsConfigValue;
|
||||
@@ -470,20 +475,24 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
|
||||
// Merge process env with the env from config
|
||||
const env = { ...process.env };
|
||||
terminalEnvironment.mergeEnvironments(env, envFromConfig);
|
||||
terminalEnvironment.mergeEnvironments(env, shellLaunchConfig.env);
|
||||
Object.keys(env).filter(k => env[k] === undefined).forEach(k => {
|
||||
delete env[k];
|
||||
});
|
||||
const castedEnv = env as platform.IProcessEnvironment;
|
||||
terminalEnvironment.mergeEnvironments(castedEnv, envFromConfig);
|
||||
terminalEnvironment.mergeEnvironments(castedEnv, shellLaunchConfig.env);
|
||||
|
||||
// Sanitize the environment, removing any undesirable VS Code and Electron environment
|
||||
// variables
|
||||
sanitizeProcessEnvironment(env, 'VSCODE_IPC_HOOK_CLI');
|
||||
sanitizeProcessEnvironment(castedEnv, 'VSCODE_IPC_HOOK_CLI');
|
||||
|
||||
// Continue env initialization, merging in the env from the launch
|
||||
// config and adding keys that are needed to create the process
|
||||
terminalEnvironment.addTerminalEnvironmentKeys(env, pkg.version, platform.locale, terminalConfig.get('setLocaleVariables'));
|
||||
terminalEnvironment.addTerminalEnvironmentKeys(castedEnv, pkg.version, platform.locale, terminalConfig.get('setLocaleVariables') as boolean);
|
||||
|
||||
// Fork the process and listen for messages
|
||||
this._logService.debug(`Terminal process launching on ext host`, shellLaunchConfig, initialCwd, cols, rows, env);
|
||||
const p = new TerminalProcess(shellLaunchConfig, initialCwd, cols, rows, env, terminalConfig.get('windowsEnableConpty'));
|
||||
this._logService.debug(`Terminal process launching on ext host`, shellLaunchConfig, initialCwd, cols, rows, castedEnv);
|
||||
const p = new TerminalProcess(shellLaunchConfig, initialCwd, cols, rows, castedEnv, terminalConfig.get('windowsEnableConpty') as boolean);
|
||||
p.onProcessIdReady(pid => this._proxy.$sendProcessPid(id, pid));
|
||||
p.onProcessTitleChanged(title => this._proxy.$sendProcessTitle(id, title));
|
||||
p.onProcessData(data => this._proxy.$sendProcessData(id, data));
|
||||
@@ -560,20 +569,20 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
});
|
||||
}
|
||||
|
||||
private _getTerminalById(id: number): ExtHostTerminal {
|
||||
private _getTerminalById(id: number): ExtHostTerminal | null {
|
||||
return this._getTerminalObjectById(this._terminals, id);
|
||||
}
|
||||
|
||||
private _getTerminalRendererById(id: number): ExtHostTerminalRenderer {
|
||||
private _getTerminalRendererById(id: number): ExtHostTerminalRenderer | null {
|
||||
return this._getTerminalObjectById(this._terminalRenderers, id);
|
||||
}
|
||||
|
||||
private _getTerminalObjectById<T extends ExtHostTerminal | ExtHostTerminalRenderer>(array: T[], id: number): T {
|
||||
private _getTerminalObjectById<T extends ExtHostTerminal | ExtHostTerminalRenderer>(array: T[], id: number): T | null {
|
||||
const index = this._getTerminalObjectIndexById(array, id);
|
||||
return index !== null ? array[index] : null;
|
||||
}
|
||||
|
||||
private _getTerminalObjectIndexById<T extends ExtHostTerminal | ExtHostTerminalRenderer>(array: T[], id: number): number {
|
||||
private _getTerminalObjectIndexById<T extends ExtHostTerminal | ExtHostTerminalRenderer>(array: T[], id: number): number | null {
|
||||
let index: number | null = null;
|
||||
array.some((item, i) => {
|
||||
const thisId = item._id;
|
||||
|
||||
@@ -17,7 +17,8 @@ import { TreeItemCollapsibleState, ThemeIcon, MarkdownString } from 'vs/workbenc
|
||||
import { isUndefinedOrNull, isString } from 'vs/base/common/types';
|
||||
import { equals, coalesce } from 'vs/base/common/arrays';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IExtensionDescription, checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
type TreeItemHandle = string;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { EditorViewColumn } from 'vs/workbench/api/shared/editor';
|
||||
import * as vscode from 'vscode';
|
||||
import { ExtHostWebviewsShape, IMainContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle, WebviewPanelViewState, WebviewInsetHandle } from './extHost.protocol';
|
||||
import { Disposable } from './extHostTypes';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
type IconPath = URI | { light: URI, dark: URI };
|
||||
|
||||
|
||||
@@ -20,10 +20,9 @@ import { IRawFileMatch2, resultIsMatch } from 'vs/workbench/services/search/comm
|
||||
import { Workspace, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { Range, RelativePattern } from 'vs/workbench/api/node/extHostTypes';
|
||||
import { ITextQueryBuilderOptions } from 'vs/workbench/contrib/search/common/queryBuilder';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import * as vscode from 'vscode';
|
||||
import { ExtHostWorkspaceShape, IWorkspaceData, MainThreadMessageServiceShape, MainThreadWorkspaceShape, IMainContext, MainContext, IStaticWorkspaceData } from './extHost.protocol';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { Barrier } from 'vs/base/common/async';
|
||||
|
||||
export interface IExtHostWorkspaceProvider {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { UriComponents } from 'vs/base/common/uri';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
export interface TaskDefinitionDTO {
|
||||
type: string;
|
||||
@@ -84,7 +84,7 @@ export interface TaskHandleDTO {
|
||||
export interface TaskDTO {
|
||||
_id: string;
|
||||
name?: string;
|
||||
execution: ProcessExecutionDTO | ShellExecutionDTO | CustomExecutionDTO;
|
||||
execution: ProcessExecutionDTO | ShellExecutionDTO | CustomExecutionDTO | undefined;
|
||||
definition: TaskDefinitionDTO;
|
||||
isBackground?: boolean;
|
||||
source: TaskSourceDTO;
|
||||
@@ -102,7 +102,7 @@ export interface TaskSetDTO {
|
||||
|
||||
export interface TaskExecutionDTO {
|
||||
id: string;
|
||||
task: TaskDTO;
|
||||
task: TaskDTO | undefined;
|
||||
}
|
||||
|
||||
export interface TaskProcessStartedDTO {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,27 +15,26 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
// tslint:disable-next-line: import-patterns no-standalone-editor
|
||||
import { SimpleConfigurationService as StandaloneEditorConfigurationService, SimpleDialogService as StandaloneEditorDialogService, StandaloneKeybindingService, SimpleResourcePropertiesService } from 'vs/editor/standalone/browser/simpleServices';
|
||||
import { IDialogService, IFileDialogService, IPickAndOpenOptions, ISaveDialogOptions, IOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IDownloadService } from 'vs/platform/download/common/download';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IEnvironmentService, IExtensionHostDebugParams, IDebugParams } from 'vs/platform/environment/common/environment';
|
||||
import { IExtensionGalleryService, IQueryOptions, IGalleryExtension, InstallOperation, StatisticType, ITranslation, IGalleryExtensionVersion, IExtensionIdentifier, IReportedExtension, IExtensionManagementService, ILocalExtension, IGalleryMetadata } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionGalleryService, IQueryOptions, IGalleryExtension, InstallOperation, StatisticType, ITranslation, IGalleryExtensionVersion, IExtensionIdentifier, IReportedExtension, IExtensionManagementService, ILocalExtension, IGalleryMetadata, IExtensionTipsService, ExtensionRecommendationReason, IExtensionRecommendation } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IPager } from 'vs/base/common/paging';
|
||||
import { IExtensionManifest, ExtensionType, ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { NullExtensionService, IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IURLHandler, IURLService } from 'vs/platform/url/common/url';
|
||||
import { IJSONEditingService, IJSONValue } from 'vs/workbench/services/configuration/common/jsonEditing';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { ITelemetryService, ITelemetryData, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { AbstractLifecycleService } from 'vs/platform/lifecycle/common/lifecycleService';
|
||||
import { ILogService, NullLogService, LogLevel } from 'vs/platform/log/common/log';
|
||||
import { ILogService, LogLevel, ConsoleLogService } from 'vs/platform/log/common/log';
|
||||
import { ShutdownReason, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IMenubarService, IMenubarData } from 'vs/platform/menubar/common/menubar';
|
||||
import { IProductService } from 'vs/platform/product/common/product';
|
||||
import { IRemoteAuthorityResolverService, ResolvedAuthority } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||
import { joinPath, isEqualOrParent, isEqual } from 'vs/base/common/resources';
|
||||
import { joinPath, isEqualOrParent, isEqual, dirname } from 'vs/base/common/resources';
|
||||
import { basename } from 'vs/base/common/path';
|
||||
import { ISearchService, ITextQueryProps, ISearchProgressItem, ISearchComplete, IFileQueryProps, SearchProviderType, ISearchResultProvider, ITextQuery, IFileMatch, QueryType, FileMatch, pathIncludedInQuery } from 'vs/workbench/services/search/common/search';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
@@ -47,7 +46,7 @@ import { editorMatchesToTextSearchResults, addContextToEditorMatches } from 'vs/
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { InMemoryStorageService, IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { ITextMateService, IGrammar as ITextMategrammar } from 'vs/workbench/services/textMate/common/textMateService';
|
||||
import { LanguageId } from 'vs/editor/common/modes';
|
||||
import { LanguageId, TokenizationRegistry } from 'vs/editor/common/modes';
|
||||
import { IUpdateService, State } from 'vs/platform/update/common/update';
|
||||
import { IWindowConfiguration, IPath, IPathsToWaitFor, IWindowService, INativeOpenDialogOptions, IEnterWorkspaceResult, IURIToOpen, IMessageBoxResult, IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { IProcessEnvironment, isWindows } from 'vs/base/common/platform';
|
||||
@@ -60,6 +59,7 @@ import { IWorkspaceContextService, Workspace, toWorkspaceFolders, IWorkspaceFold
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { Color, RGBA } from 'vs/base/common/color';
|
||||
|
||||
export const workspaceResource = URI.file(isWindows ? 'C:\\simpleWorkspace' : '/simpleWorkspace');
|
||||
|
||||
@@ -351,6 +351,45 @@ registerSingleton(IExtensionGalleryService, SimpleExtensionGalleryService, true)
|
||||
|
||||
//#region Extension Management
|
||||
|
||||
//#region Extension Tips
|
||||
|
||||
export class SimpleExtensionTipsService implements IExtensionTipsService {
|
||||
_serviceBrand: any;
|
||||
|
||||
onRecommendationChange = Event.None;
|
||||
|
||||
getAllRecommendationsWithReason(): { [id: string]: { reasonId: ExtensionRecommendationReason; reasonText: string; }; } {
|
||||
return Object.create(null);
|
||||
}
|
||||
|
||||
getFileBasedRecommendations(): IExtensionRecommendation[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
getOtherRecommendations(): Promise<IExtensionRecommendation[]> {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
getWorkspaceRecommendations(): Promise<IExtensionRecommendation[]> {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
getKeymapRecommendations(): IExtensionRecommendation[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
toggleIgnoredRecommendation(extensionId: string, shouldIgnore: boolean): void {
|
||||
}
|
||||
|
||||
getAllIgnoredRecommendations(): { global: string[]; workspace: string[]; } {
|
||||
return Object.create(null);
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IExtensionTipsService, SimpleExtensionTipsService, true);
|
||||
|
||||
//#endregion
|
||||
|
||||
export class SimpleExtensionManagementService implements IExtensionManagementService {
|
||||
|
||||
_serviceBrand: any;
|
||||
@@ -429,81 +468,15 @@ export class SimpleExtensionURLHandler implements IExtensionUrlHandler {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
registerExtensionHandler(extensionId: ExtensionIdentifier, handler: IURLHandler): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
registerExtensionHandler(extensionId: ExtensionIdentifier, handler: IURLHandler): void { }
|
||||
|
||||
unregisterExtensionHandler(extensionId: ExtensionIdentifier): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
unregisterExtensionHandler(extensionId: ExtensionIdentifier): void { }
|
||||
}
|
||||
|
||||
registerSingleton(IExtensionUrlHandler, SimpleExtensionURLHandler, true);
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region File Dialog
|
||||
|
||||
export class SimpleFileDialogService implements IFileDialogService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
defaultFilePath(schemeFilter?: string): URI {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
defaultFolderPath(schemeFilter?: string): URI {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
defaultWorkspacePath(schemeFilter?: string): URI {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
pickFileFolderAndOpen(options: IPickAndOpenOptions): Promise<any> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
pickFileAndOpen(options: IPickAndOpenOptions): Promise<any> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
pickFolderAndOpen(options: IPickAndOpenOptions): Promise<any> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
pickWorkspaceAndOpen(options: IPickAndOpenOptions): Promise<any> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
showSaveDialog(options: ISaveDialogOptions): Promise<URI> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
showOpenDialog(options: IOpenDialogOptions): Promise<URI[]> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IFileDialogService, SimpleFileDialogService, true);
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region JSON Editing
|
||||
|
||||
export class SimpleJSONEditingService implements IJSONEditingService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
write(resource: URI, value: IJSONValue, save: boolean): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IJSONEditingService, SimpleJSONEditingService, true);
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Keybinding
|
||||
|
||||
export class SimpleKeybindingService extends StandaloneKeybindingService {
|
||||
@@ -572,7 +545,7 @@ registerSingleton(ILifecycleService, SimpleLifecycleService);
|
||||
|
||||
//#region Log
|
||||
|
||||
export class SimpleLogService extends NullLogService { }
|
||||
export class SimpleLogService extends ConsoleLogService { }
|
||||
|
||||
//#endregion
|
||||
|
||||
@@ -789,13 +762,36 @@ export class SimpleRemoteFileService implements IFileService {
|
||||
|
||||
moveFile(_source: URI, _target: URI, _overwrite?: boolean): Promise<IFileStat> { return Promise.resolve(null!); }
|
||||
|
||||
copyFile(_source: URI, _target: URI, _overwrite?: boolean): Promise<IFileStat> { throw new Error('not implemented'); }
|
||||
copyFile(_source: URI, _target: URI, _overwrite?: boolean): Promise<any> {
|
||||
const parent = fileMap.get(dirname(_target));
|
||||
if (!parent) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
createFile(_resource: URI, _content?: string, _options?: ICreateFileOptions): Promise<IFileStat> { throw new Error('not implemented'); }
|
||||
return this.resolveContent(_source).then(content => {
|
||||
return Promise.resolve(createFile(parent, basename(_target.path), content.value));
|
||||
});
|
||||
}
|
||||
|
||||
createFile(_resource: URI, _content?: string, _options?: ICreateFileOptions): Promise<IFileStat> {
|
||||
const parent = fileMap.get(dirname(_resource));
|
||||
if (!parent) {
|
||||
return Promise.reject(new Error(`Unable to create file in ${dirname(_resource).path}`));
|
||||
}
|
||||
|
||||
return Promise.resolve(createFile(parent, basename(_resource.path)));
|
||||
}
|
||||
|
||||
readFolder(_resource: URI) { return Promise.resolve([]); }
|
||||
|
||||
createFolder(_resource: URI): Promise<IFileStat> { throw new Error('not implemented'); }
|
||||
createFolder(_resource: URI): Promise<IFileStat> {
|
||||
const parent = fileMap.get(dirname(_resource));
|
||||
if (!parent) {
|
||||
return Promise.reject(new Error(`Unable to create folder in ${dirname(_resource).path}`));
|
||||
}
|
||||
|
||||
return Promise.resolve(createFolder(parent, basename(_resource.path)));
|
||||
}
|
||||
|
||||
registerProvider(_scheme: string, _provider) { return { dispose() { } }; }
|
||||
|
||||
@@ -814,50 +810,52 @@ export class SimpleRemoteFileService implements IFileService {
|
||||
dispose(): void { }
|
||||
}
|
||||
|
||||
function createFile(parent: IFileStat, name: string, content: string = ''): IFileStat {
|
||||
const file: IFileStat = {
|
||||
resource: joinPath(parent.resource, name),
|
||||
etag: Date.now().toString(),
|
||||
mtime: Date.now(),
|
||||
isDirectory: false,
|
||||
name
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
parent.children.push(file);
|
||||
|
||||
fileMap.set(file.resource, file);
|
||||
|
||||
contentMap.set(file.resource, {
|
||||
resource: joinPath(parent.resource, name),
|
||||
etag: Date.now().toString(),
|
||||
mtime: Date.now(),
|
||||
value: content,
|
||||
encoding: 'utf8',
|
||||
name
|
||||
} as IContent);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
function createFolder(parent: IFileStat, name: string): IFileStat {
|
||||
const folder: IFileStat = {
|
||||
resource: joinPath(parent.resource, name),
|
||||
etag: Date.now().toString(),
|
||||
mtime: Date.now(),
|
||||
isDirectory: true,
|
||||
name,
|
||||
children: []
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
parent.children.push(folder);
|
||||
|
||||
fileMap.set(folder.resource, folder);
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
function initFakeFileSystem(): void {
|
||||
|
||||
function createFile(parent: IFileStat, name: string, content: string): void {
|
||||
const file: IFileStat = {
|
||||
resource: joinPath(parent.resource, name),
|
||||
etag: Date.now().toString(),
|
||||
mtime: Date.now(),
|
||||
isDirectory: false,
|
||||
name
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
parent.children.push(file);
|
||||
|
||||
fileMap.set(file.resource, file);
|
||||
|
||||
contentMap.set(file.resource, {
|
||||
resource: joinPath(parent.resource, name),
|
||||
etag: Date.now().toString(),
|
||||
mtime: Date.now(),
|
||||
value: content,
|
||||
encoding: 'utf8',
|
||||
name
|
||||
} as IContent);
|
||||
}
|
||||
|
||||
function createFolder(parent: IFileStat, name: string): IFileStat {
|
||||
const folder: IFileStat = {
|
||||
resource: joinPath(parent.resource, name),
|
||||
etag: Date.now().toString(),
|
||||
mtime: Date.now(),
|
||||
isDirectory: true,
|
||||
name,
|
||||
children: []
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
parent.children.push(folder);
|
||||
|
||||
fileMap.set(folder.resource, folder);
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
const root: IFileStat = {
|
||||
resource: workspaceResource,
|
||||
etag: Date.now().toString(),
|
||||
@@ -1055,7 +1053,7 @@ registerSingleton(IFileService, SimpleRemoteFileService);
|
||||
|
||||
//#region Request
|
||||
|
||||
export const IRequestService = createDecorator<IRequestService>('requestService2');
|
||||
export const IRequestService = createDecorator<IRequestService>('requestService');
|
||||
|
||||
export interface IRequestService {
|
||||
_serviceBrand: any;
|
||||
@@ -1136,7 +1134,6 @@ export class SimpleSearchService implements ISearchService {
|
||||
}
|
||||
|
||||
// Don't support other resource schemes than files for now
|
||||
// todo@remote
|
||||
// why is that? we should search for resources from other
|
||||
// schemes
|
||||
else if (resource.scheme !== Schemas.file) {
|
||||
@@ -1217,6 +1214,8 @@ registerSingleton(ITelemetryService, SimpleTelemetryService);
|
||||
|
||||
//#region Textmate
|
||||
|
||||
TokenizationRegistry.setColorMap([<any>null, new Color(new RGBA(212, 212, 212, 1)), new Color(new RGBA(30, 30, 30, 1))]);
|
||||
|
||||
export class SimpleTextMateService implements ITextMateService {
|
||||
|
||||
_serviceBrand: any;
|
||||
@@ -1619,7 +1618,7 @@ export class SimpleWindowsService implements IWindowsService {
|
||||
}
|
||||
|
||||
getWindows(): Promise<{ id: number; workspace?: IWorkspaceIdentifier; folderUri?: ISingleFolderWorkspaceIdentifier; title: string; filename?: string; }[]> {
|
||||
throw new Error('not implemented');
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
getWindowCount(): Promise<number> {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user