Archived
Merge from vscode 817eb6b0c720a4ecbc13c020afbbebfed667aa09 (#7356)
This commit is contained in:
@@ -41,13 +41,7 @@ var editorEntryPoints = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
var editorResources = [
|
var editorResources = [
|
||||||
'out-build/vs/{base,editor}/**/*.{svg,png}',
|
'out-editor-build/vs/base/browser/ui/codiconLabel/**/*.ttf'
|
||||||
'!out-build/vs/base/browser/ui/splitview/**/*',
|
|
||||||
'!out-build/vs/base/browser/ui/toolbar/**/*',
|
|
||||||
'!out-build/vs/base/browser/ui/octiconLabel/**/*',
|
|
||||||
'!out-build/vs/base/browser/ui/codiconLabel/**/*',
|
|
||||||
'!out-build/vs/workbench/**',
|
|
||||||
'!**/test/**'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
var BUNDLED_FILE_HEADER = [
|
var BUNDLED_FILE_HEADER = [
|
||||||
@@ -92,7 +86,6 @@ const extractEditorSrcTask = task.define('extract-editor-src', () => {
|
|||||||
],
|
],
|
||||||
redirects: {
|
redirects: {
|
||||||
'vs/base/browser/ui/octiconLabel/octiconLabel': 'vs/base/browser/ui/octiconLabel/octiconLabel.mock',
|
'vs/base/browser/ui/octiconLabel/octiconLabel': 'vs/base/browser/ui/octiconLabel/octiconLabel.mock',
|
||||||
'vs/base/browser/ui/codiconLabel/codiconLabel': 'vs/base/browser/ui/codiconLabel/codiconLabel.mock',
|
|
||||||
},
|
},
|
||||||
shakeLevel: 2, // 0-Files, 1-InnerFile, 2-ClassMembers
|
shakeLevel: 2, // 0-Files, 1-InnerFile, 2-ClassMembers
|
||||||
importIgnorePattern: /(^vs\/css!)|(promise-polyfill\/polyfill)/,
|
importIgnorePattern: /(^vs\/css!)|(promise-polyfill\/polyfill)/,
|
||||||
|
|||||||
+12
-10
@@ -130,7 +130,7 @@ function createESMSourcesAndResources2(options) {
|
|||||||
write(getDestAbsoluteFilePath(file), JSON.stringify(tsConfig, null, '\t'));
|
write(getDestAbsoluteFilePath(file), JSON.stringify(tsConfig, null, '\t'));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (/\.d\.ts$/.test(file) || /\.css$/.test(file) || /\.js$/.test(file)) {
|
if (/\.d\.ts$/.test(file) || /\.css$/.test(file) || /\.js$/.test(file) || /\.ttf$/.test(file)) {
|
||||||
// Transport the files directly
|
// Transport the files directly
|
||||||
write(getDestAbsoluteFilePath(file), fs.readFileSync(path.join(SRC_FOLDER, file)));
|
write(getDestAbsoluteFilePath(file), fs.readFileSync(path.join(SRC_FOLDER, file)));
|
||||||
continue;
|
continue;
|
||||||
@@ -250,15 +250,20 @@ function transportCSS(module, enqueue, write) {
|
|||||||
const filename = path.join(SRC_DIR, module);
|
const filename = path.join(SRC_DIR, module);
|
||||||
const fileContents = fs.readFileSync(filename).toString();
|
const fileContents = fs.readFileSync(filename).toString();
|
||||||
const inlineResources = 'base64'; // see https://github.com/Microsoft/monaco-editor/issues/148
|
const inlineResources = 'base64'; // see https://github.com/Microsoft/monaco-editor/issues/148
|
||||||
const inlineResourcesLimit = 300000; //3000; // see https://github.com/Microsoft/monaco-editor/issues/336
|
const newContents = _rewriteOrInlineUrls(fileContents, inlineResources === 'base64');
|
||||||
const newContents = _rewriteOrInlineUrls(fileContents, inlineResources === 'base64', inlineResourcesLimit);
|
|
||||||
write(module, newContents);
|
write(module, newContents);
|
||||||
return true;
|
return true;
|
||||||
function _rewriteOrInlineUrls(contents, forceBase64, inlineByteLimit) {
|
function _rewriteOrInlineUrls(contents, forceBase64) {
|
||||||
return _replaceURL(contents, (url) => {
|
return _replaceURL(contents, (url) => {
|
||||||
let imagePath = path.join(path.dirname(module), url);
|
const fontMatch = url.match(/^(.*).ttf\?(.*)$/);
|
||||||
let fileContents = fs.readFileSync(path.join(SRC_DIR, imagePath));
|
if (fontMatch) {
|
||||||
if (fileContents.length < inlineByteLimit) {
|
const relativeFontPath = `${fontMatch[1]}.ttf`; // trim the query parameter
|
||||||
|
const fontPath = path.join(path.dirname(module), relativeFontPath);
|
||||||
|
enqueue(fontPath);
|
||||||
|
return relativeFontPath;
|
||||||
|
}
|
||||||
|
const imagePath = path.join(path.dirname(module), url);
|
||||||
|
const fileContents = fs.readFileSync(path.join(SRC_DIR, imagePath));
|
||||||
const MIME = /\.svg$/.test(url) ? 'image/svg+xml' : 'image/png';
|
const MIME = /\.svg$/.test(url) ? 'image/svg+xml' : 'image/png';
|
||||||
let DATA = ';base64,' + fileContents.toString('base64');
|
let DATA = ';base64,' + fileContents.toString('base64');
|
||||||
if (!forceBase64 && /\.svg$/.test(url)) {
|
if (!forceBase64 && /\.svg$/.test(url)) {
|
||||||
@@ -276,9 +281,6 @@ function transportCSS(module, enqueue, write) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '"data:' + MIME + DATA + '"';
|
return '"data:' + MIME + DATA + '"';
|
||||||
}
|
|
||||||
enqueue(imagePath);
|
|
||||||
return url;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function _replaceURL(contents, replacer) {
|
function _replaceURL(contents, replacer) {
|
||||||
|
|||||||
+12
-11
@@ -154,7 +154,7 @@ export function createESMSourcesAndResources2(options: IOptions2): void {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/\.d\.ts$/.test(file) || /\.css$/.test(file) || /\.js$/.test(file)) {
|
if (/\.d\.ts$/.test(file) || /\.css$/.test(file) || /\.js$/.test(file) || /\.ttf$/.test(file)) {
|
||||||
// Transport the files directly
|
// Transport the files directly
|
||||||
write(getDestAbsoluteFilePath(file), fs.readFileSync(path.join(SRC_FOLDER, file)));
|
write(getDestAbsoluteFilePath(file), fs.readFileSync(path.join(SRC_FOLDER, file)));
|
||||||
continue;
|
continue;
|
||||||
@@ -290,18 +290,23 @@ function transportCSS(module: string, enqueue: (module: string) => void, write:
|
|||||||
const filename = path.join(SRC_DIR, module);
|
const filename = path.join(SRC_DIR, module);
|
||||||
const fileContents = fs.readFileSync(filename).toString();
|
const fileContents = fs.readFileSync(filename).toString();
|
||||||
const inlineResources = 'base64'; // see https://github.com/Microsoft/monaco-editor/issues/148
|
const inlineResources = 'base64'; // see https://github.com/Microsoft/monaco-editor/issues/148
|
||||||
const inlineResourcesLimit = 300000;//3000; // see https://github.com/Microsoft/monaco-editor/issues/336
|
|
||||||
|
|
||||||
const newContents = _rewriteOrInlineUrls(fileContents, inlineResources === 'base64', inlineResourcesLimit);
|
const newContents = _rewriteOrInlineUrls(fileContents, inlineResources === 'base64');
|
||||||
write(module, newContents);
|
write(module, newContents);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
function _rewriteOrInlineUrls(contents: string, forceBase64: boolean, inlineByteLimit: number): string {
|
function _rewriteOrInlineUrls(contents: string, forceBase64: boolean): string {
|
||||||
return _replaceURL(contents, (url) => {
|
return _replaceURL(contents, (url) => {
|
||||||
let imagePath = path.join(path.dirname(module), url);
|
const fontMatch = url.match(/^(.*).ttf\?(.*)$/);
|
||||||
let fileContents = fs.readFileSync(path.join(SRC_DIR, imagePath));
|
if (fontMatch) {
|
||||||
|
const relativeFontPath = `${fontMatch[1]}.ttf`; // trim the query parameter
|
||||||
|
const fontPath = path.join(path.dirname(module), relativeFontPath);
|
||||||
|
enqueue(fontPath);
|
||||||
|
return relativeFontPath;
|
||||||
|
}
|
||||||
|
|
||||||
if (fileContents.length < inlineByteLimit) {
|
const imagePath = path.join(path.dirname(module), url);
|
||||||
|
const fileContents = fs.readFileSync(path.join(SRC_DIR, imagePath));
|
||||||
const MIME = /\.svg$/.test(url) ? 'image/svg+xml' : 'image/png';
|
const MIME = /\.svg$/.test(url) ? 'image/svg+xml' : 'image/png';
|
||||||
let DATA = ';base64,' + fileContents.toString('base64');
|
let DATA = ';base64,' + fileContents.toString('base64');
|
||||||
|
|
||||||
@@ -320,10 +325,6 @@ function transportCSS(module: string, enqueue: (module: string) => void, write:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '"data:' + MIME + DATA + '"';
|
return '"data:' + MIME + DATA + '"';
|
||||||
}
|
|
||||||
|
|
||||||
enqueue(imagePath);
|
|
||||||
return url;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
"url": "vscode://schemas/keybindings"
|
"url": "vscode://schemas/keybindings"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fileMatch": "vscode://defaultsettings/settings.json",
|
"fileMatch": "vscode://defaultsettings/*/*.json",
|
||||||
"url": "vscode://schemas/settings/default"
|
"url": "vscode://schemas/settings/default"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -469,11 +469,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "git.clean",
|
"command": "git.clean",
|
||||||
"when": "config.git.enabled && gitOpenRepositoryCount != 0 && !gitFreshRepository"
|
"when": "config.git.enabled && gitOpenRepositoryCount != 0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "git.cleanAll",
|
"command": "git.cleanAll",
|
||||||
"when": "config.git.enabled && gitOpenRepositoryCount != 0 && !gitFreshRepository"
|
"when": "config.git.enabled && gitOpenRepositoryCount != 0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "git.commit",
|
"command": "git.commit",
|
||||||
@@ -763,7 +763,7 @@
|
|||||||
{
|
{
|
||||||
"command": "git.cleanAll",
|
"command": "git.cleanAll",
|
||||||
"group": "5_stage",
|
"group": "5_stage",
|
||||||
"when": "scmProvider == git && !gitFreshRepository"
|
"when": "scmProvider == git"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "git.stashIncludeUntracked",
|
"command": "git.stashIncludeUntracked",
|
||||||
@@ -831,7 +831,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "git.cleanAll",
|
"command": "git.cleanAll",
|
||||||
"when": "scmProvider == git && scmResourceGroup == workingTree && !gitFreshRepository",
|
"when": "scmProvider == git && scmResourceGroup == workingTree",
|
||||||
"group": "1_modification"
|
"group": "1_modification"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -841,7 +841,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "git.cleanAll",
|
"command": "git.cleanAll",
|
||||||
"when": "scmProvider == git && scmResourceGroup == workingTree && !gitFreshRepository",
|
"when": "scmProvider == git && scmResourceGroup == workingTree",
|
||||||
"group": "inline"
|
"group": "inline"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -850,6 +850,53 @@
|
|||||||
"group": "inline"
|
"group": "inline"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"scm/resourceFolder/context": [
|
||||||
|
{
|
||||||
|
"command": "git.stage",
|
||||||
|
"when": "scmProvider == git && scmResourceGroup == merge",
|
||||||
|
"group": "1_modification"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "git.stage",
|
||||||
|
"when": "scmProvider == git && scmResourceGroup == merge",
|
||||||
|
"group": "inline"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "git.unstage",
|
||||||
|
"when": "scmProvider == git && scmResourceGroup == index",
|
||||||
|
"group": "1_modification"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "git.unstage",
|
||||||
|
"when": "scmProvider == git && scmResourceGroup == index",
|
||||||
|
"group": "inline"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "git.stage",
|
||||||
|
"when": "scmProvider == git && scmResourceGroup == workingTree",
|
||||||
|
"group": "1_modification"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "git.clean",
|
||||||
|
"when": "scmProvider == git && scmResourceGroup == workingTree",
|
||||||
|
"group": "1_modification"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "git.clean",
|
||||||
|
"when": "scmProvider == git && scmResourceGroup == workingTree",
|
||||||
|
"group": "inline"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "git.stage",
|
||||||
|
"when": "scmProvider == git && scmResourceGroup == workingTree",
|
||||||
|
"group": "inline"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "git.ignore",
|
||||||
|
"when": "scmProvider == git && scmResourceGroup == workingTree",
|
||||||
|
"group": "1_modification@3"
|
||||||
|
}
|
||||||
|
],
|
||||||
"scm/resourceState/context": [
|
"scm/resourceState/context": [
|
||||||
{
|
{
|
||||||
"command": "git.stage",
|
"command": "git.stage",
|
||||||
@@ -933,12 +980,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "git.clean",
|
"command": "git.clean",
|
||||||
"when": "scmProvider == git && scmResourceGroup == workingTree && !gitFreshRepository",
|
"when": "scmProvider == git && scmResourceGroup == workingTree",
|
||||||
"group": "1_modification"
|
"group": "1_modification"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "git.clean",
|
"command": "git.clean",
|
||||||
"when": "scmProvider == git && scmResourceGroup == workingTree && !gitFreshRepository",
|
"when": "scmProvider == git && scmResourceGroup == workingTree",
|
||||||
"group": "inline"
|
"group": "inline"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
"command.syncRebase": "Sync (Rebase)",
|
"command.syncRebase": "Sync (Rebase)",
|
||||||
"command.publish": "Publish Branch",
|
"command.publish": "Publish Branch",
|
||||||
"command.showOutput": "Show Git Output",
|
"command.showOutput": "Show Git Output",
|
||||||
"command.ignore": "Add File to .gitignore",
|
"command.ignore": "Add to .gitignore",
|
||||||
"command.stashIncludeUntracked": "Stash (Include Untracked)",
|
"command.stashIncludeUntracked": "Stash (Include Untracked)",
|
||||||
"command.stash": "Stash",
|
"command.stash": "Stash",
|
||||||
"command.stashPop": "Pop Stash...",
|
"command.stashPop": "Pop Stash...",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { commands, Uri, Command, EventEmitter, Event, scm, SourceControl, SourceControlInputBox, SourceControlResourceGroup, SourceControlResourceState, SourceControlResourceDecorations, SourceControlInputBoxValidation, Disposable, ProgressLocation, window, workspace, WorkspaceEdit, ThemeColor, Decoration, Memento, SourceControlInputBoxValidationType, OutputChannel, LogLevel, env, ProgressOptions, CancellationToken } from 'vscode';
|
import { Uri, Command, EventEmitter, Event, scm, SourceControl, SourceControlInputBox, SourceControlResourceGroup, SourceControlResourceState, SourceControlResourceDecorations, SourceControlInputBoxValidation, Disposable, ProgressLocation, window, workspace, WorkspaceEdit, ThemeColor, Decoration, Memento, SourceControlInputBoxValidationType, OutputChannel, LogLevel, env, ProgressOptions, CancellationToken } from 'vscode';
|
||||||
import { Repository as BaseRepository, Commit, Stash, GitError, Submodule, CommitOptions, ForcePushMode } from './git';
|
import { Repository as BaseRepository, Commit, Stash, GitError, Submodule, CommitOptions, ForcePushMode } from './git';
|
||||||
import { anyEvent, filterEvent, eventToPromise, dispose, find, isDescendant, IDisposable, onceEvent, EmptyDisposable, debounceEvent, combinedDisposable } from './util';
|
import { anyEvent, filterEvent, eventToPromise, dispose, find, isDescendant, IDisposable, onceEvent, EmptyDisposable, debounceEvent, combinedDisposable } from './util';
|
||||||
import { memoize, throttle, debounce } from './decorators';
|
import { memoize, throttle, debounce } from './decorators';
|
||||||
@@ -633,7 +633,6 @@ export class Repository implements Disposable {
|
|||||||
|
|
||||||
private isRepositoryHuge = false;
|
private isRepositoryHuge = false;
|
||||||
private didWarnAboutLimit = false;
|
private didWarnAboutLimit = false;
|
||||||
private isFreshRepository: boolean | undefined = undefined;
|
|
||||||
|
|
||||||
private disposables: Disposable[] = [];
|
private disposables: Disposable[] = [];
|
||||||
|
|
||||||
@@ -1507,15 +1506,6 @@ export class Repository implements Disposable {
|
|||||||
// set count badge
|
// set count badge
|
||||||
this.setCountBadge();
|
this.setCountBadge();
|
||||||
|
|
||||||
// Disable `Discard All Changes` for "fresh" repositories
|
|
||||||
// https://github.com/Microsoft/vscode/issues/43066
|
|
||||||
const isFreshRepository = !this._HEAD || !this._HEAD.commit;
|
|
||||||
|
|
||||||
if (this.isFreshRepository !== isFreshRepository) {
|
|
||||||
commands.executeCommand('setContext', 'gitFreshRepository', isFreshRepository);
|
|
||||||
this.isFreshRepository = isFreshRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._onDidChangeStatus.fire();
|
this._onDidChangeStatus.fire();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jsonc-parser": "^2.1.1",
|
"jsonc-parser": "^2.1.1",
|
||||||
"request-light": "^0.2.4",
|
"request-light": "^0.2.4",
|
||||||
"vscode-json-languageservice": "^3.3.3",
|
"vscode-json-languageservice": "^3.3.4",
|
||||||
"vscode-languageserver": "^5.3.0-next.8",
|
"vscode-languageserver": "^5.3.0-next.8",
|
||||||
"vscode-nls": "^4.1.1",
|
"vscode-nls": "^4.1.1",
|
||||||
"vscode-uri": "^2.0.3"
|
"vscode-uri": "^2.0.3"
|
||||||
|
|||||||
@@ -73,10 +73,10 @@ request-light@^0.2.4:
|
|||||||
https-proxy-agent "^2.2.1"
|
https-proxy-agent "^2.2.1"
|
||||||
vscode-nls "^4.0.0"
|
vscode-nls "^4.0.0"
|
||||||
|
|
||||||
vscode-json-languageservice@^3.3.3:
|
vscode-json-languageservice@^3.3.4:
|
||||||
version "3.3.3"
|
version "3.3.4"
|
||||||
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.3.3.tgz#f7e512a2cd5e82fecbebf507d6fceaea47661297"
|
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.3.4.tgz#4ff67580491d3a5dc469f4a78643f20adff0278d"
|
||||||
integrity sha512-5vL3OXTUuQpn6+tGd47dopio+7WwbtIZ07zfYMzAUX8eVWPZjfEsLeSWmQk5Xw+vwgu+j5zC4koz5UofLDGGRA==
|
integrity sha512-/nuI4uDBfxyVyeGtBdYwP/tIaXYKOoymUOSozYKLzsmrDmu555gZpzc11LrARa96z92wSaa5hfjTtNMAoM2mxw==
|
||||||
dependencies:
|
dependencies:
|
||||||
jsonc-parser "^2.1.1"
|
jsonc-parser "^2.1.1"
|
||||||
vscode-languageserver-types "^3.15.0-next.2"
|
vscode-languageserver-types "^3.15.0-next.2"
|
||||||
|
|||||||
@@ -182,13 +182,12 @@ pre.hljs code > div {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Theming */
|
|
||||||
|
|
||||||
pre code {
|
pre code {
|
||||||
color: var(--vscode-editor-foreground);
|
color: var(--vscode-editor-foreground);
|
||||||
tab-size: 4;
|
tab-size: 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Theming */
|
||||||
|
|
||||||
.vscode-light pre {
|
.vscode-light pre {
|
||||||
background-color: rgba(220, 220, 220, 0.4);
|
background-color: rgba(220, 220, 220, 0.4);
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ export default class MergeConflictCodeLensProvider implements vscode.CodeLensPro
|
|||||||
this.codeLensRegistrationHandle = vscode.languages.registerCodeLensProvider([
|
this.codeLensRegistrationHandle = vscode.languages.registerCodeLensProvider([
|
||||||
{ scheme: 'file' },
|
{ scheme: 'file' },
|
||||||
{ scheme: 'untitled' },
|
{ scheme: 'untitled' },
|
||||||
|
{ scheme: 'vscode-userdata' },
|
||||||
], this);
|
], this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
"support.type",
|
"support.type",
|
||||||
"entity.name.type",
|
"entity.name.type",
|
||||||
"entity.name.namespace",
|
"entity.name.namespace",
|
||||||
|
"entity.other.attribute",
|
||||||
"entity.name.scope-resolution",
|
"entity.name.scope-resolution",
|
||||||
"entity.name.class",
|
"entity.name.class",
|
||||||
"storage.type.numeric.go",
|
"storage.type.numeric.go",
|
||||||
@@ -76,7 +77,8 @@
|
|||||||
"source.cpp keyword.operator.new",
|
"source.cpp keyword.operator.new",
|
||||||
"keyword.operator.delete",
|
"keyword.operator.delete",
|
||||||
"keyword.other.using",
|
"keyword.other.using",
|
||||||
"keyword.other.operator"
|
"keyword.other.operator",
|
||||||
|
"entity.name.operator"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#C586C0"
|
"foreground": "#C586C0"
|
||||||
@@ -171,72 +173,11 @@
|
|||||||
"foreground": "#d7ba7d"
|
"foreground": "#d7ba7d"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Scopes that are potentially C++ only follow
|
|
||||||
{
|
{
|
||||||
"scope": "source.cpp entity.name",
|
"scope": "entity.name.label",
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#C8C8C8"
|
"foreground": "#C8C8C8"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp keyword.control.directive",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#9B9B9B"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp entity.name.function.operator",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#B4B4B4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp entity.name.function.preprocessor",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#C586C0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp entity.name.label",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#C8C8C8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp entity.name.operator.custom-literal",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#DADADA"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp entity.name.operator.custom-literal.number",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#B5CEA8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp entity.name.operator.custom-literal.string",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#ce9178"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp variable.other.enummember",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#B8D7A3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp variable.other.property",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#DADADA"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp variable.parameter",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#7F7F7F"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"scope": [
|
"scope": [
|
||||||
"constant.numeric"
|
"constant.numeric",
|
||||||
|
"entity.name.operator.custom-literal.number",
|
||||||
|
"variable.other.enummember",
|
||||||
|
"keyword.operator.plus.exponent",
|
||||||
|
"keyword.operator.minus.exponent"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#b5cea8"
|
"foreground": "#b5cea8"
|
||||||
@@ -166,7 +170,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"scope": "meta.preprocessor",
|
"scope": [
|
||||||
|
"meta.preprocessor",
|
||||||
|
"keyword.control.directive"
|
||||||
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#569cd6"
|
"foreground": "#569cd6"
|
||||||
}
|
}
|
||||||
@@ -208,13 +215,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"scope": "storage.modifier",
|
"scope": [
|
||||||
|
"storage.modifier",
|
||||||
|
"keyword.operator.noexcept"
|
||||||
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#569cd6"
|
"foreground": "#569cd6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"scope": "string",
|
"scope": [
|
||||||
|
"string",
|
||||||
|
"entity.name.operator.custom-literal.string",
|
||||||
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#ce9178"
|
"foreground": "#ce9178"
|
||||||
}
|
}
|
||||||
@@ -294,8 +307,11 @@
|
|||||||
"keyword.operator.expression",
|
"keyword.operator.expression",
|
||||||
"keyword.operator.cast",
|
"keyword.operator.cast",
|
||||||
"keyword.operator.sizeof",
|
"keyword.operator.sizeof",
|
||||||
|
"keyword.operator.typeid",
|
||||||
|
"keyword.operator.alignas",
|
||||||
"keyword.operator.instanceof",
|
"keyword.operator.instanceof",
|
||||||
"keyword.operator.logical.python"
|
"keyword.operator.logical.python",
|
||||||
|
"keyword.operator.wordlike"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#569cd6"
|
"foreground": "#569cd6"
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
"support.type",
|
"support.type",
|
||||||
"entity.name.type",
|
"entity.name.type",
|
||||||
"entity.name.namespace",
|
"entity.name.namespace",
|
||||||
|
"entity.other.attribute",
|
||||||
"entity.name.scope-resolution",
|
"entity.name.scope-resolution",
|
||||||
"entity.name.class",
|
"entity.name.class",
|
||||||
"storage.type.numeric.go",
|
"storage.type.numeric.go",
|
||||||
@@ -76,7 +77,8 @@
|
|||||||
"source.cpp keyword.operator.new",
|
"source.cpp keyword.operator.new",
|
||||||
"source.cpp keyword.operator.delete",
|
"source.cpp keyword.operator.delete",
|
||||||
"keyword.other.using",
|
"keyword.other.using",
|
||||||
"keyword.other.operator"
|
"keyword.other.operator",
|
||||||
|
"entity.name.operator"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#AF00DB"
|
"foreground": "#AF00DB"
|
||||||
@@ -171,54 +173,11 @@
|
|||||||
"foreground": "#ff0000"
|
"foreground": "#ff0000"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Scopes that are potentially C++ only follow
|
|
||||||
{
|
{
|
||||||
"scope": "source.cpp entity.name",
|
"scope": "entity.name.label",
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#000000"
|
"foreground": "#000000"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp keyword.control.directive",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#808080"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp entity.name.function.operator",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#008080"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp entity.name.function.preprocessor",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#AF00DB"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp entity.name.label",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#000000"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp entity.name.operator.custom-literal.string",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#0451a5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp variable.other.enummember",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#2F4F4F"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "source.cpp variable.parameter",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#808080"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@
|
|||||||
"include": "./light_defaults.json",
|
"include": "./light_defaults.json",
|
||||||
"tokenColors": [
|
"tokenColors": [
|
||||||
{
|
{
|
||||||
"scope": ["meta.embedded", "source.groovy.embedded"],
|
"scope": [
|
||||||
|
"meta.embedded",
|
||||||
|
"source.groovy.embedded"
|
||||||
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#000000ff"
|
"foreground": "#000000ff"
|
||||||
}
|
}
|
||||||
@@ -41,7 +44,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"scope": [
|
"scope": [
|
||||||
"constant.numeric"
|
"constant.numeric",
|
||||||
|
"entity.name.operator.custom-literal.number",
|
||||||
|
"variable.other.enummember",
|
||||||
|
"keyword.operator.plus.exponent",
|
||||||
|
"keyword.operator.minus.exponent"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#09885a"
|
"foreground": "#09885a"
|
||||||
@@ -161,7 +168,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"scope": "meta.preprocessor",
|
"scope": [
|
||||||
|
"meta.preprocessor",
|
||||||
|
"keyword.control.directive"
|
||||||
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#0000ff"
|
"foreground": "#0000ff"
|
||||||
}
|
}
|
||||||
@@ -197,13 +207,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"scope": "storage.modifier",
|
"scope": [
|
||||||
|
"storage.modifier",
|
||||||
|
"keyword.operator.noexcept"
|
||||||
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#0000ff"
|
"foreground": "#0000ff"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"scope": "string",
|
"scope": [
|
||||||
|
"string",
|
||||||
|
"entity.name.operator.custom-literal.string",
|
||||||
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#a31515"
|
"foreground": "#a31515"
|
||||||
}
|
}
|
||||||
@@ -315,8 +331,11 @@
|
|||||||
"keyword.operator.expression",
|
"keyword.operator.expression",
|
||||||
"keyword.operator.cast",
|
"keyword.operator.cast",
|
||||||
"keyword.operator.sizeof",
|
"keyword.operator.sizeof",
|
||||||
|
"keyword.operator.typeid",
|
||||||
|
"keyword.operator.alignas",
|
||||||
"keyword.operator.instanceof",
|
"keyword.operator.instanceof",
|
||||||
"keyword.operator.logical.python"
|
"keyword.operator.logical.python",
|
||||||
|
"keyword.operator.wordlike"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"foreground": "#0000ff"
|
"foreground": "#0000ff"
|
||||||
|
|||||||
+1
-1
@@ -167,7 +167,7 @@
|
|||||||
"vinyl": "^2.0.0",
|
"vinyl": "^2.0.0",
|
||||||
"vinyl-fs": "^3.0.0",
|
"vinyl-fs": "^3.0.0",
|
||||||
"vsce": "1.48.0",
|
"vsce": "1.48.0",
|
||||||
"vscode-debugprotocol": "1.36.0",
|
"vscode-debugprotocol": "1.37.0",
|
||||||
"vscode-nls-dev": "^3.3.1",
|
"vscode-nls-dev": "^3.3.1",
|
||||||
"webpack": "^4.16.5",
|
"webpack": "^4.16.5",
|
||||||
"webpack-cli": "^3.3.8",
|
"webpack-cli": "^3.3.8",
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ if grep -qi Microsoft /proc/version; then
|
|||||||
WSL_EXT_WLOC=$(cmd.exe /C type %TEMP%\\remote-wsl-loc.txt)
|
WSL_EXT_WLOC=$(cmd.exe /C type %TEMP%\\remote-wsl-loc.txt)
|
||||||
cd "$CWD"
|
cd "$CWD"
|
||||||
else
|
else
|
||||||
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --locate-extension $WSL_EXT_ID >/tmp/remote-wsl-loc.txt
|
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --locate-extension $WSL_EXT_ID >/tmp/remote-wsl-loc.txt 2>/dev/null
|
||||||
WSL_EXT_WLOC=$(cat /tmp/remote-wsl-loc.txt)
|
WSL_EXT_WLOC=$(cat /tmp/remote-wsl-loc.txt)
|
||||||
fi
|
fi
|
||||||
if [ -n "$WSL_EXT_WLOC" ]; then
|
if [ -n "$WSL_EXT_WLOC" ]; then
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
|||||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||||
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
|
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
|
||||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
|
||||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||||
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
|
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
|
||||||
|
import { URI } from 'vs/base/common/uri';
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import { Button } from 'sql/base/browser/ui/button/button';
|
import { Button } from 'sql/base/browser/ui/button/button';
|
||||||
@@ -30,6 +30,7 @@ import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
|||||||
import { ILogService } from 'vs/platform/log/common/log';
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||||
|
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||||
|
|
||||||
// TODO: Make the help link 1) extensible (01/08/2018, https://github.com/Microsoft/azuredatastudio/issues/450)
|
// TODO: Make the help link 1) extensible (01/08/2018, https://github.com/Microsoft/azuredatastudio/issues/450)
|
||||||
// in case that other non-Azure sign in is to be used
|
// in case that other non-Azure sign in is to be used
|
||||||
@@ -70,10 +71,10 @@ export class FirewallRuleDialog extends Modal {
|
|||||||
@IContextViewService private _contextViewService: IContextViewService,
|
@IContextViewService private _contextViewService: IContextViewService,
|
||||||
@ITelemetryService telemetryService: ITelemetryService,
|
@ITelemetryService telemetryService: ITelemetryService,
|
||||||
@IContextKeyService contextKeyService: IContextKeyService,
|
@IContextKeyService contextKeyService: IContextKeyService,
|
||||||
@IWindowsService private _windowsService: IWindowsService,
|
|
||||||
@IClipboardService clipboardService: IClipboardService,
|
@IClipboardService clipboardService: IClipboardService,
|
||||||
@ILogService logService: ILogService,
|
@ILogService logService: ILogService,
|
||||||
@ITextResourcePropertiesService textResourcePropertiesService: ITextResourcePropertiesService
|
@ITextResourcePropertiesService textResourcePropertiesService: ITextResourcePropertiesService,
|
||||||
|
@IOpenerService private readonly openerService: IOpenerService
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
localize('createNewFirewallRule', "Create new firewall rule"),
|
localize('createNewFirewallRule', "Create new firewall rule"),
|
||||||
@@ -125,7 +126,7 @@ export class FirewallRuleDialog extends Modal {
|
|||||||
this._helpLink.setAttribute('href', firewallHelpUri);
|
this._helpLink.setAttribute('href', firewallHelpUri);
|
||||||
this._helpLink.innerHTML += localize('firewallRuleHelpDescription', "Learn more about firewall settings");
|
this._helpLink.innerHTML += localize('firewallRuleHelpDescription', "Learn more about firewall settings");
|
||||||
this._helpLink.onclick = () => {
|
this._helpLink.onclick = () => {
|
||||||
this._windowsService.openExternal(firewallHelpUri);
|
this.openerService.open(URI.parse(firewallHelpUri));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create account picker with event handling
|
// Create account picker with event handling
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { URI } from 'vs/base/common/uri';
|
|||||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
|
||||||
|
|
||||||
@extHostNamedCustomer(SqlMainContext.MainThreadExtensionManagement)
|
@extHostNamedCustomer(SqlMainContext.MainThreadExtensionManagement)
|
||||||
export class MainThreadExtensionManagement extends Disposable implements MainThreadExtensionManagementShape {
|
export class MainThreadExtensionManagement extends Disposable implements MainThreadExtensionManagementShape {
|
||||||
@@ -23,8 +22,7 @@ export class MainThreadExtensionManagement extends Disposable implements MainThr
|
|||||||
extHostContext: IExtHostContext,
|
extHostContext: IExtHostContext,
|
||||||
@IExtensionManagementService private _extensionService: IExtensionManagementService,
|
@IExtensionManagementService private _extensionService: IExtensionManagementService,
|
||||||
@IConfigurationService private _configurationService: IConfigurationService,
|
@IConfigurationService private _configurationService: IConfigurationService,
|
||||||
@INotificationService private _notificationService: INotificationService,
|
@INotificationService private _notificationService: INotificationService
|
||||||
@IWindowService protected readonly _windowService: IWindowService
|
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@@ -53,9 +51,6 @@ export class MainThreadExtensionManagement extends Disposable implements MainThr
|
|||||||
this._configurationService.updateValue('workbench.enableObsoleteApiUsageNotification', false, ConfigurationTarget.USER);
|
this._configurationService.updateValue('workbench.enableObsoleteApiUsageNotification', false, ConfigurationTarget.USER);
|
||||||
},
|
},
|
||||||
isSecondary: true
|
isSecondary: true
|
||||||
}, {
|
|
||||||
label: localize('devTools', "Open Developer Tools"),
|
|
||||||
run: () => this._windowService.openDevTools()
|
|
||||||
}]);
|
}]);
|
||||||
this._obsoleteExtensionApiUsageNotificationShown = true;
|
this._obsoleteExtensionApiUsageNotificationShown = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ import { Task } from 'sql/platform/tasks/browser/tasksRegistry';
|
|||||||
import { ObjectMetadata } from 'azdata';
|
import { ObjectMetadata } from 'azdata';
|
||||||
|
|
||||||
import { Action } from 'vs/base/common/actions';
|
import { Action } from 'vs/base/common/actions';
|
||||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
|
||||||
import * as nls from 'vs/nls';
|
import * as nls from 'vs/nls';
|
||||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { IInsightsConfig } from 'sql/platform/dashboard/browser/insightRegistry';
|
import { IInsightsConfig } from 'sql/platform/dashboard/browser/insightRegistry';
|
||||||
|
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||||
|
import { URI } from 'vs/base/common/uri';
|
||||||
|
|
||||||
export interface BaseActionContext {
|
export interface BaseActionContext {
|
||||||
object?: ObjectMetadata;
|
object?: ObjectMetadata;
|
||||||
@@ -85,6 +86,6 @@ export class ConfigureDashboardAction extends Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
runTask(accessor: ServicesAccessor): Promise<void> {
|
runTask(accessor: ServicesAccessor): Promise<void> {
|
||||||
return accessor.get<IWindowsService>(IWindowsService).openExternal(ConfigureDashboardAction.configHelpUri).then();
|
return accessor.get(IOpenerService).open(URI.parse(ConfigureDashboardAction.configHelpUri)).then();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,28 +4,31 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { Action } from 'vs/base/common/actions';
|
import { Action } from 'vs/base/common/actions';
|
||||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||||
//tslint:disable-next-line:layering
|
//tslint:disable-next-line:layering
|
||||||
import { ElectronMainService } from 'vs/platform/electron/electron-main/electronMainService';
|
import { ElectronMainService } from 'vs/platform/electron/electron-main/electronMainService';
|
||||||
|
//tslint:disable-next-line:layering
|
||||||
|
import { IElectronService } from 'vs/platform/electron/node/electron';
|
||||||
|
import { URI } from 'vs/base/common/uri';
|
||||||
|
|
||||||
export class ShowFileInFolderAction extends Action {
|
export class ShowFileInFolderAction extends Action {
|
||||||
|
|
||||||
constructor(private path: string, label: string, private windowsService: ElectronMainService) {
|
constructor(private path: string, label: string, @IElectronService private windowsService: ElectronMainService) {
|
||||||
super('showItemInFolder.action.id', label);
|
super('showItemInFolder.action.id', label);
|
||||||
}
|
}
|
||||||
|
|
||||||
run(): Promise<void> {
|
run(): Promise<void> {
|
||||||
return this.windowsService.showItemInFolder(this.path);
|
return this.windowsService.showItemInFolder(undefined, this.path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OpenFileInFolderAction extends Action {
|
export class OpenFileInFolderAction extends Action {
|
||||||
|
|
||||||
constructor(private path: string, label: string, private windowsService: IWindowsService) {
|
constructor(private path: string, label: string, @IOpenerService private openerService: IOpenerService) {
|
||||||
super('showItemInFolder.action.id', label);
|
super('showItemInFolder.action.id', label);
|
||||||
}
|
}
|
||||||
|
|
||||||
run() {
|
run() {
|
||||||
return this.windowsService.openExternal(this.path);
|
return this.openerService.open(URI.file(this.path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import { IInsightOptions } from 'sql/workbench/parts/charts/common/interfaces';
|
|||||||
import { IFileService } from 'vs/platform/files/common/files';
|
import { IFileService } from 'vs/platform/files/common/files';
|
||||||
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
|
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||||
import { VSBuffer } from 'vs/base/common/buffer';
|
import { VSBuffer } from 'vs/base/common/buffer';
|
||||||
|
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||||
|
|
||||||
export interface IChartActionContext {
|
export interface IChartActionContext {
|
||||||
options: IInsightOptions;
|
options: IInsightOptions;
|
||||||
@@ -142,10 +143,10 @@ export class SaveImageAction extends Action {
|
|||||||
public static ICON = 'saveAsImage';
|
public static ICON = 'saveAsImage';
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@IWindowsService private readonly windowsService: IWindowsService,
|
|
||||||
@INotificationService private readonly notificationService: INotificationService,
|
@INotificationService private readonly notificationService: INotificationService,
|
||||||
@IFileService private readonly fileService: IFileService,
|
@IFileService private readonly fileService: IFileService,
|
||||||
@IFileDialogService private readonly fileDialogService: IFileDialogService
|
@IFileDialogService private readonly fileDialogService: IFileDialogService,
|
||||||
|
@IOpenerService private readonly openerService: IOpenerService
|
||||||
) {
|
) {
|
||||||
super(SaveImageAction.ID, SaveImageAction.LABEL, SaveImageAction.ICON);
|
super(SaveImageAction.ID, SaveImageAction.LABEL, SaveImageAction.ICON);
|
||||||
}
|
}
|
||||||
@@ -168,7 +169,7 @@ export class SaveImageAction extends Action {
|
|||||||
if (err) {
|
if (err) {
|
||||||
this.notificationService.error(err.message);
|
this.notificationService.error(err.message);
|
||||||
} else {
|
} else {
|
||||||
this.windowsService.openExternal(filePath.toString());
|
this.openerService.open(filePath, { openExternal: true });
|
||||||
this.notificationService.notify({
|
this.notificationService.notify({
|
||||||
severity: Severity.Error,
|
severity: Severity.Error,
|
||||||
message: localize('chartSaved', "Saved Chart to path: {0}", filePath.toString())
|
message: localize('chartSaved', "Saved Chart to path: {0}", filePath.toString())
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
|||||||
import { ObjectExplorerActionsContext } from 'sql/workbench/parts/objectExplorer/browser/objectExplorerActions';
|
import { ObjectExplorerActionsContext } from 'sql/workbench/parts/objectExplorer/browser/objectExplorerActions';
|
||||||
import { ItemContextKey } from 'sql/workbench/parts/dashboard/browser/widgets/explorer/explorerTreeContext';
|
import { ItemContextKey } from 'sql/workbench/parts/dashboard/browser/widgets/explorer/explorerTreeContext';
|
||||||
import { ManageActionContext } from 'sql/workbench/browser/actions';
|
import { ManageActionContext } from 'sql/workbench/browser/actions';
|
||||||
|
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||||
import { MarkdownOutputComponent } from 'sql/workbench/parts/notebook/browser/outputs/markdownOutput.component';
|
import { MarkdownOutputComponent } from 'sql/workbench/parts/notebook/browser/outputs/markdownOutput.component';
|
||||||
import { registerCellComponent } from 'sql/platform/notebooks/common/outputRegistry';
|
import { registerCellComponent } from 'sql/platform/notebooks/common/outputRegistry';
|
||||||
import { TextCellComponent } from 'sql/workbench/parts/notebook/browser/cellViews/textCell.component';
|
import { TextCellComponent } from 'sql/workbench/parts/notebook/browser/cellViews/textCell.component';
|
||||||
@@ -130,6 +131,7 @@ registerAction({
|
|||||||
const viewletService = accessor.get(IViewletService);
|
const viewletService = accessor.get(IViewletService);
|
||||||
const workspaceEditingService = accessor.get(IWorkspaceEditingService);
|
const workspaceEditingService = accessor.get(IWorkspaceEditingService);
|
||||||
const windowService = accessor.get(IWindowService);
|
const windowService = accessor.get(IWindowService);
|
||||||
|
const hostService = accessor.get(IHostService);
|
||||||
let folders = [];
|
let folders = [];
|
||||||
if (!options.folderPath) {
|
if (!options.folderPath) {
|
||||||
return;
|
return;
|
||||||
@@ -141,7 +143,7 @@ registerAction({
|
|||||||
return windowService.openWindow([{ folderUri: folders[0] }], { forceNewWindow: options.forceNewWindow });
|
return windowService.openWindow([{ folderUri: folders[0] }], { forceNewWindow: options.forceNewWindow });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return windowService.reloadWindow();
|
return hostService.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "codicon";
|
font-family: "codicon";
|
||||||
src: url("./codicon.ttf?e042d2dda15ef7b36b910e3edf539f26") format("truetype");
|
src: url("./codicon.ttf?3b584136fb1f0186a1ee578cdcb5240b") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
.codicon[class*='codicon-'] {
|
.codicon[class*='codicon-'] {
|
||||||
@@ -203,152 +203,153 @@
|
|||||||
.codicon-folder-active:before { content: "\f162" }
|
.codicon-folder-active:before { content: "\f162" }
|
||||||
.codicon-folder-opened:before { content: "\f163" }
|
.codicon-folder-opened:before { content: "\f163" }
|
||||||
.codicon-folder:before { content: "\f164" }
|
.codicon-folder:before { content: "\f164" }
|
||||||
.codicon-gift:before { content: "\f165" }
|
.codicon-gear:before { content: "\f165" }
|
||||||
.codicon-gist-secret:before { content: "\f166" }
|
.codicon-gift:before { content: "\f166" }
|
||||||
.codicon-gist:before { content: "\f167" }
|
.codicon-gist-secret:before { content: "\f167" }
|
||||||
.codicon-git-commit:before { content: "\f168" }
|
.codicon-gist:before { content: "\f168" }
|
||||||
.codicon-git-compare:before { content: "\f169" }
|
.codicon-git-commit:before { content: "\f169" }
|
||||||
.codicon-git-merge:before { content: "\f16a" }
|
.codicon-git-compare:before { content: "\f16a" }
|
||||||
.codicon-github-action:before { content: "\f16b" }
|
.codicon-git-merge:before { content: "\f16b" }
|
||||||
.codicon-github-alt:before { content: "\f16c" }
|
.codicon-github-action:before { content: "\f16c" }
|
||||||
.codicon-github:before { content: "\f16d" }
|
.codicon-github-alt:before { content: "\f16d" }
|
||||||
.codicon-globe:before { content: "\f16e" }
|
.codicon-github:before { content: "\f16e" }
|
||||||
.codicon-go-to-file:before { content: "\f16f" }
|
.codicon-globe:before { content: "\f16f" }
|
||||||
.codicon-grabber:before { content: "\f170" }
|
.codicon-go-to-file:before { content: "\f170" }
|
||||||
.codicon-graph:before { content: "\f171" }
|
.codicon-grabber:before { content: "\f171" }
|
||||||
.codicon-gripper:before { content: "\f172" }
|
.codicon-graph:before { content: "\f172" }
|
||||||
.codicon-heart:before { content: "\f173" }
|
.codicon-gripper:before { content: "\f173" }
|
||||||
.codicon-history:before { content: "\f174" }
|
.codicon-heart:before { content: "\f174" }
|
||||||
.codicon-home:before { content: "\f175" }
|
.codicon-history:before { content: "\f175" }
|
||||||
.codicon-horizontal-rule:before { content: "\f176" }
|
.codicon-home:before { content: "\f176" }
|
||||||
.codicon-hubot:before { content: "\f177" }
|
.codicon-horizontal-rule:before { content: "\f177" }
|
||||||
.codicon-inbox:before { content: "\f178" }
|
.codicon-hubot:before { content: "\f178" }
|
||||||
.codicon-interface:before { content: "\f179" }
|
.codicon-inbox:before { content: "\f179" }
|
||||||
.codicon-issue-closed:before { content: "\f17a" }
|
.codicon-interface:before { content: "\f17a" }
|
||||||
.codicon-issue-reopened:before { content: "\f17b" }
|
.codicon-issue-closed:before { content: "\f17b" }
|
||||||
.codicon-issues:before { content: "\f17c" }
|
.codicon-issue-reopened:before { content: "\f17c" }
|
||||||
.codicon-italic:before { content: "\f17d" }
|
.codicon-issues:before { content: "\f17d" }
|
||||||
.codicon-jersey:before { content: "\f17e" }
|
.codicon-italic:before { content: "\f17e" }
|
||||||
.codicon-json:before { content: "\f17f" }
|
.codicon-jersey:before { content: "\f17f" }
|
||||||
.codicon-kebab-vertical:before { content: "\f180" }
|
.codicon-json:before { content: "\f180" }
|
||||||
.codicon-key:before { content: "\f181" }
|
.codicon-kebab-vertical:before { content: "\f181" }
|
||||||
.codicon-keyword:before { content: "\f182" }
|
.codicon-key:before { content: "\f182" }
|
||||||
.codicon-law:before { content: "\f183" }
|
.codicon-keyword:before { content: "\f183" }
|
||||||
.codicon-lightbulb-autofix:before { content: "\f184" }
|
.codicon-law:before { content: "\f184" }
|
||||||
.codicon-link-external:before { content: "\f185" }
|
.codicon-lightbulb-autofix:before { content: "\f185" }
|
||||||
.codicon-link:before { content: "\f186" }
|
.codicon-link-external:before { content: "\f186" }
|
||||||
.codicon-list-ordered:before { content: "\f187" }
|
.codicon-link:before { content: "\f187" }
|
||||||
.codicon-list-unordered:before { content: "\f188" }
|
.codicon-list-ordered:before { content: "\f188" }
|
||||||
.codicon-live-share:before { content: "\f189" }
|
.codicon-list-unordered:before { content: "\f189" }
|
||||||
.codicon-loading:before { content: "\f18a" }
|
.codicon-live-share:before { content: "\f18a" }
|
||||||
.codicon-location:before { content: "\f18b" }
|
.codicon-loading:before { content: "\f18b" }
|
||||||
.codicon-mail-read:before { content: "\f18c" }
|
.codicon-location:before { content: "\f18c" }
|
||||||
.codicon-mail:before { content: "\f18d" }
|
.codicon-mail-read:before { content: "\f18d" }
|
||||||
.codicon-markdown:before { content: "\f18e" }
|
.codicon-mail:before { content: "\f18e" }
|
||||||
.codicon-megaphone:before { content: "\f18f" }
|
.codicon-markdown:before { content: "\f18f" }
|
||||||
.codicon-mention:before { content: "\f190" }
|
.codicon-megaphone:before { content: "\f190" }
|
||||||
.codicon-method:before { content: "\f191" }
|
.codicon-mention:before { content: "\f191" }
|
||||||
.codicon-milestone:before { content: "\f192" }
|
.codicon-method:before { content: "\f192" }
|
||||||
.codicon-misc:before { content: "\f193" }
|
.codicon-milestone:before { content: "\f193" }
|
||||||
.codicon-mortar-board:before { content: "\f194" }
|
.codicon-misc:before { content: "\f194" }
|
||||||
.codicon-move:before { content: "\f195" }
|
.codicon-mortar-board:before { content: "\f195" }
|
||||||
.codicon-multiple-windows:before { content: "\f196" }
|
.codicon-move:before { content: "\f196" }
|
||||||
.codicon-mute:before { content: "\f197" }
|
.codicon-multiple-windows:before { content: "\f197" }
|
||||||
.codicon-namespace:before { content: "\f198" }
|
.codicon-mute:before { content: "\f198" }
|
||||||
.codicon-no-newline:before { content: "\f199" }
|
.codicon-namespace:before { content: "\f199" }
|
||||||
.codicon-note:before { content: "\f19a" }
|
.codicon-no-newline:before { content: "\f19a" }
|
||||||
.codicon-numeric:before { content: "\f19b" }
|
.codicon-note:before { content: "\f19b" }
|
||||||
.codicon-octoface:before { content: "\f19c" }
|
.codicon-numeric:before { content: "\f19c" }
|
||||||
.codicon-open-preview:before { content: "\f19d" }
|
.codicon-octoface:before { content: "\f19d" }
|
||||||
.codicon-operator:before { content: "\f19e" }
|
.codicon-open-preview:before { content: "\f19e" }
|
||||||
.codicon-package:before { content: "\f19f" }
|
.codicon-operator:before { content: "\f19f" }
|
||||||
.codicon-paintcan:before { content: "\f1a0" }
|
.codicon-package:before { content: "\f1a0" }
|
||||||
.codicon-parameter:before { content: "\f1a1" }
|
.codicon-paintcan:before { content: "\f1a1" }
|
||||||
.codicon-pause:before { content: "\f1a2" }
|
.codicon-parameter:before { content: "\f1a2" }
|
||||||
.codicon-pin:before { content: "\f1a3" }
|
.codicon-pause:before { content: "\f1a3" }
|
||||||
.codicon-play:before { content: "\f1a4" }
|
.codicon-pin:before { content: "\f1a4" }
|
||||||
.codicon-plug:before { content: "\f1a5" }
|
.codicon-play:before { content: "\f1a5" }
|
||||||
.codicon-preserve-case:before { content: "\f1a6" }
|
.codicon-plug:before { content: "\f1a6" }
|
||||||
.codicon-preview:before { content: "\f1a7" }
|
.codicon-preserve-case:before { content: "\f1a7" }
|
||||||
.codicon-project:before { content: "\f1a8" }
|
.codicon-preview:before { content: "\f1a8" }
|
||||||
.codicon-property:before { content: "\f1a9" }
|
.codicon-project:before { content: "\f1a9" }
|
||||||
.codicon-pulse:before { content: "\f1aa" }
|
.codicon-property:before { content: "\f1aa" }
|
||||||
.codicon-question:before { content: "\f1ab" }
|
.codicon-pulse:before { content: "\f1ab" }
|
||||||
.codicon-quote:before { content: "\f1ac" }
|
.codicon-question:before { content: "\f1ac" }
|
||||||
.codicon-radio-tower:before { content: "\f1ad" }
|
.codicon-quote:before { content: "\f1ad" }
|
||||||
.codicon-reactions:before { content: "\f1ae" }
|
.codicon-radio-tower:before { content: "\f1ae" }
|
||||||
.codicon-references:before { content: "\f1af" }
|
.codicon-reactions:before { content: "\f1af" }
|
||||||
.codicon-refresh:before { content: "\f1b0" }
|
.codicon-references:before { content: "\f1b0" }
|
||||||
.codicon-regex:before { content: "\f1b1" }
|
.codicon-refresh:before { content: "\f1b1" }
|
||||||
.codicon-remote:before { content: "\f1b2" }
|
.codicon-regex:before { content: "\f1b2" }
|
||||||
.codicon-remove:before { content: "\f1b3" }
|
.codicon-remote:before { content: "\f1b3" }
|
||||||
.codicon-replace-all:before { content: "\f1b4" }
|
.codicon-remove:before { content: "\f1b4" }
|
||||||
.codicon-replace:before { content: "\f1b5" }
|
.codicon-replace-all:before { content: "\f1b5" }
|
||||||
.codicon-repo-clone:before { content: "\f1b6" }
|
.codicon-replace:before { content: "\f1b6" }
|
||||||
.codicon-repo-force-push:before { content: "\f1b7" }
|
.codicon-repo-clone:before { content: "\f1b7" }
|
||||||
.codicon-repo-pull:before { content: "\f1b8" }
|
.codicon-repo-force-push:before { content: "\f1b8" }
|
||||||
.codicon-repo-push:before { content: "\f1b9" }
|
.codicon-repo-pull:before { content: "\f1b9" }
|
||||||
.codicon-report:before { content: "\f1ba" }
|
.codicon-repo-push:before { content: "\f1ba" }
|
||||||
.codicon-request-changes:before { content: "\f1bb" }
|
.codicon-report:before { content: "\f1bb" }
|
||||||
.codicon-restart:before { content: "\f1bc" }
|
.codicon-request-changes:before { content: "\f1bc" }
|
||||||
.codicon-rocket:before { content: "\f1bd" }
|
.codicon-restart:before { content: "\f1bd" }
|
||||||
.codicon-root-folder-opened:before { content: "\f1be" }
|
.codicon-rocket:before { content: "\f1be" }
|
||||||
.codicon-root-folder:before { content: "\f1bf" }
|
.codicon-root-folder-opened:before { content: "\f1bf" }
|
||||||
.codicon-rss:before { content: "\f1c0" }
|
.codicon-root-folder:before { content: "\f1c0" }
|
||||||
.codicon-ruby:before { content: "\f1c1" }
|
.codicon-rss:before { content: "\f1c1" }
|
||||||
.codicon-ruler:before { content: "\f1c2" }
|
.codicon-ruby:before { content: "\f1c2" }
|
||||||
.codicon-save-all:before { content: "\f1c3" }
|
.codicon-ruler:before { content: "\f1c3" }
|
||||||
.codicon-save-as:before { content: "\f1c4" }
|
.codicon-save-all:before { content: "\f1c4" }
|
||||||
.codicon-save:before { content: "\f1c5" }
|
.codicon-save-as:before { content: "\f1c5" }
|
||||||
.codicon-screen-full:before { content: "\f1c6" }
|
.codicon-save:before { content: "\f1c6" }
|
||||||
.codicon-screen-normal:before { content: "\f1c7" }
|
.codicon-screen-full:before { content: "\f1c7" }
|
||||||
.codicon-search-stop:before { content: "\f1c8" }
|
.codicon-screen-normal:before { content: "\f1c8" }
|
||||||
.codicon-selection:before { content: "\f1c9" }
|
.codicon-search-stop:before { content: "\f1c9" }
|
||||||
.codicon-server:before { content: "\f1ca" }
|
.codicon-selection:before { content: "\f1ca" }
|
||||||
.codicon-settings:before { content: "\f1cb" }
|
.codicon-server:before { content: "\f1cb" }
|
||||||
.codicon-shield:before { content: "\f1cc" }
|
.codicon-settings:before { content: "\f1cc" }
|
||||||
.codicon-smiley:before { content: "\f1cd" }
|
.codicon-shield:before { content: "\f1cd" }
|
||||||
.codicon-snippet:before { content: "\f1ce" }
|
.codicon-smiley:before { content: "\f1ce" }
|
||||||
.codicon-sort-precedence:before { content: "\f1cf" }
|
.codicon-snippet:before { content: "\f1cf" }
|
||||||
.codicon-split-horizontal:before { content: "\f1d0" }
|
.codicon-sort-precedence:before { content: "\f1d0" }
|
||||||
.codicon-split-vertical:before { content: "\f1d1" }
|
.codicon-split-horizontal:before { content: "\f1d1" }
|
||||||
.codicon-squirrel:before { content: "\f1d2" }
|
.codicon-split-vertical:before { content: "\f1d2" }
|
||||||
.codicon-star-empty:before { content: "\f1d3" }
|
.codicon-squirrel:before { content: "\f1d3" }
|
||||||
.codicon-star-full:before { content: "\f1d4" }
|
.codicon-star-empty:before { content: "\f1d4" }
|
||||||
.codicon-star-half:before { content: "\f1d5" }
|
.codicon-star-full:before { content: "\f1d5" }
|
||||||
.codicon-start:before { content: "\f1d6" }
|
.codicon-star-half:before { content: "\f1d6" }
|
||||||
.codicon-step-into:before { content: "\f1d7" }
|
.codicon-start:before { content: "\f1d7" }
|
||||||
.codicon-step-out:before { content: "\f1d8" }
|
.codicon-step-into:before { content: "\f1d8" }
|
||||||
.codicon-step-over:before { content: "\f1d9" }
|
.codicon-step-out:before { content: "\f1d9" }
|
||||||
.codicon-string:before { content: "\f1da" }
|
.codicon-step-over:before { content: "\f1da" }
|
||||||
.codicon-structure:before { content: "\f1db" }
|
.codicon-string:before { content: "\f1db" }
|
||||||
.codicon-tasklist:before { content: "\f1dc" }
|
.codicon-structure:before { content: "\f1dc" }
|
||||||
.codicon-telescope:before { content: "\f1dd" }
|
.codicon-tasklist:before { content: "\f1dd" }
|
||||||
.codicon-text-size:before { content: "\f1de" }
|
.codicon-telescope:before { content: "\f1de" }
|
||||||
.codicon-three-bars:before { content: "\f1df" }
|
.codicon-text-size:before { content: "\f1df" }
|
||||||
.codicon-thumbsdown:before { content: "\f1e0" }
|
.codicon-three-bars:before { content: "\f1e0" }
|
||||||
.codicon-thumbsup:before { content: "\f1e1" }
|
.codicon-thumbsdown:before { content: "\f1e1" }
|
||||||
.codicon-tools:before { content: "\f1e2" }
|
.codicon-thumbsup:before { content: "\f1e2" }
|
||||||
.codicon-trash:before { content: "\f1e3" }
|
.codicon-tools:before { content: "\f1e3" }
|
||||||
.codicon-triangle-down:before { content: "\f1e4" }
|
.codicon-trash:before { content: "\f1e4" }
|
||||||
.codicon-triangle-left:before { content: "\f1e5" }
|
.codicon-triangle-down:before { content: "\f1e5" }
|
||||||
.codicon-triangle-right:before { content: "\f1e6" }
|
.codicon-triangle-left:before { content: "\f1e6" }
|
||||||
.codicon-triangle-up:before { content: "\f1e7" }
|
.codicon-triangle-right:before { content: "\f1e7" }
|
||||||
.codicon-twitter:before { content: "\f1e8" }
|
.codicon-triangle-up:before { content: "\f1e8" }
|
||||||
.codicon-unfold:before { content: "\f1e9" }
|
.codicon-twitter:before { content: "\f1e9" }
|
||||||
.codicon-unlock:before { content: "\f1ea" }
|
.codicon-unfold:before { content: "\f1ea" }
|
||||||
.codicon-unmute:before { content: "\f1eb" }
|
.codicon-unlock:before { content: "\f1eb" }
|
||||||
.codicon-unverified:before { content: "\f1ec" }
|
.codicon-unmute:before { content: "\f1ec" }
|
||||||
.codicon-variable:before { content: "\f1ed" }
|
.codicon-unverified:before { content: "\f1ed" }
|
||||||
.codicon-verified:before { content: "\f1ee" }
|
.codicon-variable:before { content: "\f1ee" }
|
||||||
.codicon-versions:before { content: "\f1ef" }
|
.codicon-verified:before { content: "\f1ef" }
|
||||||
.codicon-vm-active:before { content: "\f1f0" }
|
.codicon-versions:before { content: "\f1f0" }
|
||||||
.codicon-vm-outline:before { content: "\f1f1" }
|
.codicon-vm-active:before { content: "\f1f1" }
|
||||||
.codicon-vm-running:before { content: "\f1f2" }
|
.codicon-vm-outline:before { content: "\f1f2" }
|
||||||
.codicon-watch:before { content: "\f1f3" }
|
.codicon-vm-running:before { content: "\f1f3" }
|
||||||
.codicon-whitespace:before { content: "\f1f4" }
|
.codicon-watch:before { content: "\f1f4" }
|
||||||
.codicon-whole-word:before { content: "\f1f5" }
|
.codicon-whitespace:before { content: "\f1f5" }
|
||||||
.codicon-window:before { content: "\f1f6" }
|
.codicon-whole-word:before { content: "\f1f6" }
|
||||||
.codicon-word-wrap:before { content: "\f1f7" }
|
.codicon-window:before { content: "\f1f7" }
|
||||||
.codicon-zoom-in:before { content: "\f1f8" }
|
.codicon-word-wrap:before { content: "\f1f8" }
|
||||||
.codicon-zoom-out:before { content: "\f1f9" }
|
.codicon-zoom-in:before { content: "\f1f9" }
|
||||||
|
.codicon-zoom-out:before { content: "\f1fa" }
|
||||||
|
|||||||
Binary file not shown.
@@ -1,24 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
import { escape } from 'vs/base/common/strings';
|
|
||||||
|
|
||||||
export function renderCodicons(text: string): string {
|
|
||||||
return escape(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CodiconLabel {
|
|
||||||
|
|
||||||
private _container: HTMLElement;
|
|
||||||
|
|
||||||
constructor(container: HTMLElement) {
|
|
||||||
this._container = container;
|
|
||||||
}
|
|
||||||
|
|
||||||
set text(text: string) {
|
|
||||||
this._container.innerHTML = renderCodicons(text || '');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -295,7 +295,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
|
|||||||
|
|
||||||
render(container: HTMLElement): void {
|
render(container: HTMLElement): void {
|
||||||
const labelRenderer: ILabelRenderer = (el: HTMLElement): IDisposable | null => {
|
const labelRenderer: ILabelRenderer = (el: HTMLElement): IDisposable | null => {
|
||||||
this.element = append(el, $('a.action-label.icon'));
|
this.element = append(el, $('a.action-label.codicon'));
|
||||||
if (this.clazz) {
|
if (this.clazz) {
|
||||||
addClasses(this.element, this.clazz);
|
addClasses(this.element, this.clazz);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export interface IReplaceInputOptions extends IReplaceInputStyles {
|
|||||||
|
|
||||||
export interface IReplaceInputStyles extends IInputBoxStyles {
|
export interface IReplaceInputStyles extends IInputBoxStyles {
|
||||||
inputActiveOptionBorder?: Color;
|
inputActiveOptionBorder?: Color;
|
||||||
|
inputActiveOptionBackground?: Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NLS_DEFAULT_LABEL = nls.localize('defaultLabel', "input");
|
const NLS_DEFAULT_LABEL = nls.localize('defaultLabel', "input");
|
||||||
@@ -44,7 +45,8 @@ export class PreserveCaseCheckbox extends Checkbox {
|
|||||||
actionClassName: 'codicon-preserve-case',
|
actionClassName: 'codicon-preserve-case',
|
||||||
title: NLS_PRESERVE_CASE_LABEL + opts.appendTitle,
|
title: NLS_PRESERVE_CASE_LABEL + opts.appendTitle,
|
||||||
isChecked: opts.isChecked,
|
isChecked: opts.isChecked,
|
||||||
inputActiveOptionBorder: opts.inputActiveOptionBorder
|
inputActiveOptionBorder: opts.inputActiveOptionBorder,
|
||||||
|
inputActiveOptionBackground: opts.inputActiveOptionBackground
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,6 +62,7 @@ export class ReplaceInput extends Widget {
|
|||||||
private fixFocusOnOptionClickEnabled = true;
|
private fixFocusOnOptionClickEnabled = true;
|
||||||
|
|
||||||
private inputActiveOptionBorder?: Color;
|
private inputActiveOptionBorder?: Color;
|
||||||
|
private inputActiveOptionBackground?: Color;
|
||||||
private inputBackground?: Color;
|
private inputBackground?: Color;
|
||||||
private inputForeground?: Color;
|
private inputForeground?: Color;
|
||||||
private inputBorder?: Color;
|
private inputBorder?: Color;
|
||||||
@@ -105,6 +108,7 @@ export class ReplaceInput extends Widget {
|
|||||||
this.label = options.label || NLS_DEFAULT_LABEL;
|
this.label = options.label || NLS_DEFAULT_LABEL;
|
||||||
|
|
||||||
this.inputActiveOptionBorder = options.inputActiveOptionBorder;
|
this.inputActiveOptionBorder = options.inputActiveOptionBorder;
|
||||||
|
this.inputActiveOptionBackground = options.inputActiveOptionBackground;
|
||||||
this.inputBackground = options.inputBackground;
|
this.inputBackground = options.inputBackground;
|
||||||
this.inputForeground = options.inputForeground;
|
this.inputForeground = options.inputForeground;
|
||||||
this.inputBorder = options.inputBorder;
|
this.inputBorder = options.inputBorder;
|
||||||
@@ -181,6 +185,7 @@ export class ReplaceInput extends Widget {
|
|||||||
|
|
||||||
public style(styles: IReplaceInputStyles): void {
|
public style(styles: IReplaceInputStyles): void {
|
||||||
this.inputActiveOptionBorder = styles.inputActiveOptionBorder;
|
this.inputActiveOptionBorder = styles.inputActiveOptionBorder;
|
||||||
|
this.inputActiveOptionBackground = styles.inputActiveOptionBackground;
|
||||||
this.inputBackground = styles.inputBackground;
|
this.inputBackground = styles.inputBackground;
|
||||||
this.inputForeground = styles.inputForeground;
|
this.inputForeground = styles.inputForeground;
|
||||||
this.inputBorder = styles.inputBorder;
|
this.inputBorder = styles.inputBorder;
|
||||||
@@ -202,6 +207,7 @@ export class ReplaceInput extends Widget {
|
|||||||
if (this.domNode) {
|
if (this.domNode) {
|
||||||
const checkBoxStyles: ICheckboxStyles = {
|
const checkBoxStyles: ICheckboxStyles = {
|
||||||
inputActiveOptionBorder: this.inputActiveOptionBorder,
|
inputActiveOptionBorder: this.inputActiveOptionBorder,
|
||||||
|
inputActiveOptionBackground: this.inputActiveOptionBackground,
|
||||||
};
|
};
|
||||||
this.preserveCase.style(checkBoxStyles);
|
this.preserveCase.style(checkBoxStyles);
|
||||||
|
|
||||||
@@ -281,7 +287,8 @@ export class ReplaceInput extends Widget {
|
|||||||
this.preserveCase = this._register(new PreserveCaseCheckbox({
|
this.preserveCase = this._register(new PreserveCaseCheckbox({
|
||||||
appendTitle: '',
|
appendTitle: '',
|
||||||
isChecked: false,
|
isChecked: false,
|
||||||
inputActiveOptionBorder: this.inputActiveOptionBorder
|
inputActiveOptionBorder: this.inputActiveOptionBorder,
|
||||||
|
inputActiveOptionBackground: this.inputActiveOptionBackground,
|
||||||
}));
|
}));
|
||||||
this._register(this.preserveCase.onChange(viaKeyboard => {
|
this._register(this.preserveCase.onChange(viaKeyboard => {
|
||||||
this._onDidOptionChange.fire(viaKeyboard);
|
this._onDidOptionChange.fire(viaKeyboard);
|
||||||
|
|||||||
@@ -188,12 +188,12 @@ class BranchNode implements ISplitView, IDisposable {
|
|||||||
return this.orientation === Orientation.HORIZONTAL ? this.maximumSize : this.maximumOrthogonalSize;
|
return this.orientation === Orientation.HORIZONTAL ? this.maximumSize : this.maximumOrthogonalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onDidChange = new Emitter<number | undefined>();
|
private readonly _onDidChange = new Emitter<number | undefined>();
|
||||||
readonly onDidChange: Event<number | undefined> = this._onDidChange.event;
|
readonly onDidChange: Event<number | undefined> = this._onDidChange.event;
|
||||||
|
|
||||||
private childrenChangeDisposable: IDisposable = Disposable.None;
|
private childrenChangeDisposable: IDisposable = Disposable.None;
|
||||||
|
|
||||||
private _onDidSashReset = new Emitter<number[]>();
|
private readonly _onDidSashReset = new Emitter<number[]>();
|
||||||
readonly onDidSashReset: Event<number[]> = this._onDidSashReset.event;
|
readonly onDidSashReset: Event<number[]> = this._onDidSashReset.event;
|
||||||
private splitviewSashResetDisposable: IDisposable = Disposable.None;
|
private splitviewSashResetDisposable: IDisposable = Disposable.None;
|
||||||
private childrenSashResetDisposable: IDisposable = Disposable.None;
|
private childrenSashResetDisposable: IDisposable = Disposable.None;
|
||||||
@@ -539,7 +539,7 @@ class LeafNode implements ISplitView, IDisposable {
|
|||||||
this._onDidSetLinkedNode.fire(undefined);
|
this._onDidSetLinkedNode.fire(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onDidSetLinkedNode = new Emitter<number | undefined>();
|
private readonly _onDidSetLinkedNode = new Emitter<number | undefined>();
|
||||||
private _onDidViewChange: Event<number | undefined>;
|
private _onDidViewChange: Event<number | undefined>;
|
||||||
readonly onDidChange: Event<number | undefined>;
|
readonly onDidChange: Event<number | undefined>;
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,10 @@ export interface IKeyboardNavigationLabelProvider<T> {
|
|||||||
* element always match.
|
* element always match.
|
||||||
*/
|
*/
|
||||||
getKeyboardNavigationLabel(element: T): { toString(): string | undefined; } | undefined;
|
getKeyboardNavigationLabel(element: T): { toString(): string | undefined; } | undefined;
|
||||||
mightProducePrintableCharacter?(event: IKeyboardEvent): boolean;
|
}
|
||||||
|
|
||||||
|
export interface IKeyboardNavigationDelegate {
|
||||||
|
mightProducePrintableCharacter(event: IKeyboardEvent): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum ListDragOverEffect {
|
export const enum ListDragOverEffect {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import 'vs/css!./list';
|
import 'vs/css!./list';
|
||||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||||
import { range } from 'vs/base/common/arrays';
|
import { range } from 'vs/base/common/arrays';
|
||||||
import { IListVirtualDelegate, IListRenderer, IListEvent, IListContextMenuEvent } from './list';
|
import { IListVirtualDelegate, IListRenderer, IListEvent, IListContextMenuEvent } from './list';
|
||||||
import { List, IListStyles, IListOptions } from './listWidget';
|
import { List, IListStyles, IListOptions } from './listWidget';
|
||||||
@@ -32,7 +32,7 @@ class PagedRenderer<TElement, TTemplateData> implements IListRenderer<number, IT
|
|||||||
|
|
||||||
renderTemplate(container: HTMLElement): ITemplateData<TTemplateData> {
|
renderTemplate(container: HTMLElement): ITemplateData<TTemplateData> {
|
||||||
const data = this.renderer.renderTemplate(container);
|
const data = this.renderer.renderTemplate(container);
|
||||||
return { data, disposable: { dispose: () => { } } };
|
return { data, disposable: Disposable.None };
|
||||||
}
|
}
|
||||||
|
|
||||||
renderElement(index: number, _: number, data: ITemplateData<TTemplateData>, height: number | undefined): void {
|
renderElement(index: number, _: number, data: ITemplateData<TTemplateData>, height: number | undefined): void {
|
||||||
@@ -127,7 +127,7 @@ export class PagedList<T> implements IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get onPin(): Event<IListEvent<T>> {
|
get onPin(): Event<IListEvent<T>> {
|
||||||
return Event.map(this.list.onPin, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
|
return Event.map(this.list.onDidPin, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
|
||||||
}
|
}
|
||||||
|
|
||||||
get onContextMenu(): Event<IListContextMenuEvent<T>> {
|
get onContextMenu(): Event<IListContextMenuEvent<T>> {
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
|||||||
|
|
||||||
private readonly disposables: DisposableStore = new DisposableStore();
|
private readonly disposables: DisposableStore = new DisposableStore();
|
||||||
|
|
||||||
private _onDidChangeContentHeight = new Emitter<number>();
|
private readonly _onDidChangeContentHeight = new Emitter<number>();
|
||||||
readonly onDidChangeContentHeight: Event<number> = Event.latch(this._onDidChangeContentHeight.event);
|
readonly onDidChangeContentHeight: Event<number> = Event.latch(this._onDidChangeContentHeight.event);
|
||||||
get contentHeight(): number { return this.rangeMap.size; }
|
get contentHeight(): number { return this.rangeMap.size; }
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
|
|||||||
import { StandardKeyboardEvent, IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
import { StandardKeyboardEvent, IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||||
import { Event, Emitter, EventBufferer } from 'vs/base/common/event';
|
import { Event, Emitter, EventBufferer } from 'vs/base/common/event';
|
||||||
import { domEvent } from 'vs/base/browser/event';
|
import { domEvent } from 'vs/base/browser/event';
|
||||||
import { IListVirtualDelegate, IListRenderer, IListEvent, IListContextMenuEvent, IListMouseEvent, IListTouchEvent, IListGestureEvent, IIdentityProvider, IKeyboardNavigationLabelProvider, IListDragAndDrop, IListDragOverReaction, ListAriaRootRole, ListError } from './list';
|
import { IListVirtualDelegate, IListRenderer, IListEvent, IListContextMenuEvent, IListMouseEvent, IListTouchEvent, IListGestureEvent, IIdentityProvider, IKeyboardNavigationLabelProvider, IListDragAndDrop, IListDragOverReaction, ListAriaRootRole, ListError, IKeyboardNavigationDelegate } from './list';
|
||||||
import { ListView, IListViewOptions, IListViewDragAndDrop, IAriaProvider } from './listView';
|
import { ListView, IListViewOptions, IListViewDragAndDrop, IAriaProvider } from './listView';
|
||||||
import { Color } from 'vs/base/common/color';
|
import { Color } from 'vs/base/common/color';
|
||||||
import { mixin } from 'vs/base/common/objects';
|
import { mixin } from 'vs/base/common/objects';
|
||||||
@@ -110,7 +110,7 @@ class Trait<T> implements ISpliceable<boolean>, IDisposable {
|
|||||||
private indexes: number[] = [];
|
private indexes: number[] = [];
|
||||||
private sortedIndexes: number[] = [];
|
private sortedIndexes: number[] = [];
|
||||||
|
|
||||||
private _onChange = new Emitter<ITraitChangeEvent>();
|
private readonly _onChange = new Emitter<ITraitChangeEvent>();
|
||||||
readonly onChange: Event<ITraitChangeEvent> = this._onChange.event;
|
readonly onChange: Event<ITraitChangeEvent> = this._onChange.event;
|
||||||
|
|
||||||
get trait(): string { return this._trait; }
|
get trait(): string { return this._trait; }
|
||||||
@@ -176,7 +176,7 @@ class Trait<T> implements ISpliceable<boolean>, IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
this._onChange = dispose(this._onChange);
|
dispose(this._onChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,7 +322,8 @@ enum TypeLabelControllerState {
|
|||||||
Typing
|
Typing
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mightProducePrintableCharacter(event: IKeyboardEvent): boolean {
|
export const DefaultKeyboardNavigationDelegate = new class implements IKeyboardNavigationDelegate {
|
||||||
|
mightProducePrintableCharacter(event: IKeyboardEvent): boolean {
|
||||||
if (event.ctrlKey || event.metaKey || event.altKey) {
|
if (event.ctrlKey || event.metaKey || event.altKey) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -331,7 +332,8 @@ export function mightProducePrintableCharacter(event: IKeyboardEvent): boolean {
|
|||||||
|| (event.keyCode >= KeyCode.KEY_0 && event.keyCode <= KeyCode.KEY_9)
|
|| (event.keyCode >= KeyCode.KEY_0 && event.keyCode <= KeyCode.KEY_9)
|
||||||
|| (event.keyCode >= KeyCode.NUMPAD_0 && event.keyCode <= KeyCode.NUMPAD_9)
|
|| (event.keyCode >= KeyCode.NUMPAD_0 && event.keyCode <= KeyCode.NUMPAD_9)
|
||||||
|| (event.keyCode >= KeyCode.US_SEMICOLON && event.keyCode <= KeyCode.US_QUOTE);
|
|| (event.keyCode >= KeyCode.US_SEMICOLON && event.keyCode <= KeyCode.US_QUOTE);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class TypeLabelController<T> implements IDisposable {
|
class TypeLabelController<T> implements IDisposable {
|
||||||
|
|
||||||
@@ -347,7 +349,8 @@ class TypeLabelController<T> implements IDisposable {
|
|||||||
constructor(
|
constructor(
|
||||||
private list: List<T>,
|
private list: List<T>,
|
||||||
private view: ListView<T>,
|
private view: ListView<T>,
|
||||||
private keyboardNavigationLabelProvider: IKeyboardNavigationLabelProvider<T>
|
private keyboardNavigationLabelProvider: IKeyboardNavigationLabelProvider<T>,
|
||||||
|
private delegate: IKeyboardNavigationDelegate
|
||||||
) {
|
) {
|
||||||
this.updateOptions(list.options);
|
this.updateOptions(list.options);
|
||||||
}
|
}
|
||||||
@@ -379,7 +382,7 @@ class TypeLabelController<T> implements IDisposable {
|
|||||||
.filter(e => !isInputElement(e.target as HTMLElement))
|
.filter(e => !isInputElement(e.target as HTMLElement))
|
||||||
.filter(() => this.automaticKeyboardNavigation || this.triggered)
|
.filter(() => this.automaticKeyboardNavigation || this.triggered)
|
||||||
.map(event => new StandardKeyboardEvent(event))
|
.map(event => new StandardKeyboardEvent(event))
|
||||||
.filter(this.keyboardNavigationLabelProvider.mightProducePrintableCharacter ? e => this.keyboardNavigationLabelProvider.mightProducePrintableCharacter!(e) : e => mightProducePrintableCharacter(e))
|
.filter(e => this.delegate.mightProducePrintableCharacter(e))
|
||||||
.forEach(e => { e.stopPropagation(); e.preventDefault(); })
|
.forEach(e => { e.stopPropagation(); e.preventDefault(); })
|
||||||
.map(event => event.browserEvent.key)
|
.map(event => event.browserEvent.key)
|
||||||
.event;
|
.event;
|
||||||
@@ -818,6 +821,7 @@ export interface IListOptions<T> extends IListStyles {
|
|||||||
readonly enableKeyboardNavigation?: boolean;
|
readonly enableKeyboardNavigation?: boolean;
|
||||||
readonly automaticKeyboardNavigation?: boolean;
|
readonly automaticKeyboardNavigation?: boolean;
|
||||||
readonly keyboardNavigationLabelProvider?: IKeyboardNavigationLabelProvider<T>;
|
readonly keyboardNavigationLabelProvider?: IKeyboardNavigationLabelProvider<T>;
|
||||||
|
readonly keyboardNavigationDelegate?: IKeyboardNavigationDelegate;
|
||||||
readonly ariaRole?: ListAriaRootRole;
|
readonly ariaRole?: ListAriaRootRole;
|
||||||
readonly ariaLabel?: string;
|
readonly ariaLabel?: string;
|
||||||
readonly keyboardSupport?: boolean;
|
readonly keyboardSupport?: boolean;
|
||||||
@@ -1107,13 +1111,11 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
|||||||
return Event.map(this.eventBufferer.wrapEvent(this.selection.onChange), e => this.toListEvent(e));
|
return Event.map(this.eventBufferer.wrapEvent(this.selection.onChange), e => this.toListEvent(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onDidOpen = new Emitter<IListEvent<T>>();
|
private readonly _onDidOpen = new Emitter<IListEvent<T>>();
|
||||||
readonly onDidOpen: Event<IListEvent<T>> = this._onDidOpen.event;
|
readonly onDidOpen: Event<IListEvent<T>> = this._onDidOpen.event;
|
||||||
|
|
||||||
private _onPin = new Emitter<number[]>();
|
private readonly _onDidPin = new Emitter<IListEvent<T>>();
|
||||||
@memoize get onPin(): Event<IListEvent<T>> {
|
readonly onDidPin: Event<IListEvent<T>> = this._onDidPin.event;
|
||||||
return Event.map(this._onPin.event, indexes => this.toListEvent({ indexes }));
|
|
||||||
}
|
|
||||||
|
|
||||||
get domId(): string { return this.view.domId; }
|
get domId(): string { return this.view.domId; }
|
||||||
get onDidScroll(): Event<ScrollEvent> { return this.view.onDidScroll; }
|
get onDidScroll(): Event<ScrollEvent> { return this.view.onDidScroll; }
|
||||||
@@ -1166,7 +1168,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
|||||||
readonly onDidFocus: Event<void>;
|
readonly onDidFocus: Event<void>;
|
||||||
readonly onDidBlur: Event<void>;
|
readonly onDidBlur: Event<void>;
|
||||||
|
|
||||||
private _onDidDispose = new Emitter<void>();
|
private readonly _onDidDispose = new Emitter<void>();
|
||||||
readonly onDidDispose: Event<void> = this._onDidDispose.event;
|
readonly onDidDispose: Event<void> = this._onDidDispose.event;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -1228,7 +1230,8 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_options.keyboardNavigationLabelProvider) {
|
if (_options.keyboardNavigationLabelProvider) {
|
||||||
this.typeLabelController = new TypeLabelController(this, this.view, _options.keyboardNavigationLabelProvider);
|
const delegate = _options.keyboardNavigationDelegate || DefaultKeyboardNavigationDelegate;
|
||||||
|
this.typeLabelController = new TypeLabelController(this, this.view, _options.keyboardNavigationLabelProvider, delegate);
|
||||||
this.disposables.add(this.typeLabelController);
|
this.disposables.add(this.typeLabelController);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1582,14 +1585,14 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
|||||||
this._onDidOpen.fire({ indexes, elements: indexes.map(i => this.view.element(i)), browserEvent });
|
this._onDidOpen.fire({ indexes, elements: indexes.map(i => this.view.element(i)), browserEvent });
|
||||||
}
|
}
|
||||||
|
|
||||||
pin(indexes: number[]): void {
|
pin(indexes: number[], browserEvent?: UIEvent): void {
|
||||||
for (const index of indexes) {
|
for (const index of indexes) {
|
||||||
if (index < 0 || index >= this.length) {
|
if (index < 0 || index >= this.length) {
|
||||||
throw new ListError(this.user, `Invalid index ${index}`);
|
throw new ListError(this.user, `Invalid index ${index}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._onPin.fire(indexes);
|
this._onDidPin.fire({ indexes, elements: indexes.map(i => this.view.element(i)), browserEvent });
|
||||||
}
|
}
|
||||||
|
|
||||||
style(styles: IListStyles): void {
|
style(styles: IListStyles): void {
|
||||||
@@ -1626,7 +1629,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
|||||||
this.disposables.dispose();
|
this.disposables.dispose();
|
||||||
|
|
||||||
this._onDidOpen.dispose();
|
this._onDidOpen.dispose();
|
||||||
this._onPin.dispose();
|
this._onDidPin.dispose();
|
||||||
this._onDidDispose.dispose();
|
this._onDidDispose.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ class SelectListRenderer implements IListRenderer<ISelectOptionItem, ISelectList
|
|||||||
|
|
||||||
get templateId(): string { return SELECT_OPTION_ENTRY_TEMPLATE_ID; }
|
get templateId(): string { return SELECT_OPTION_ENTRY_TEMPLATE_ID; }
|
||||||
|
|
||||||
constructor() { }
|
|
||||||
|
|
||||||
renderTemplate(container: HTMLElement): ISelectListTemplateData {
|
renderTemplate(container: HTMLElement): ISelectListTemplateData {
|
||||||
const data: ISelectListTemplateData = Object.create(null);
|
const data: ISelectListTemplateData = Object.create(null);
|
||||||
data.disposables = [];
|
data.disposables = [];
|
||||||
|
|||||||
@@ -76,6 +76,9 @@
|
|||||||
background-position: center center;
|
background-position: center center;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bold font style does not go well with CJK fonts */
|
/* Bold font style does not go well with CJK fonts */
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M4 8C4 8.19778 3.94135 8.39112 3.83147 8.55557C3.72159 8.72002 3.56541 8.84819 3.38268 8.92388C3.19996 8.99957 2.99889 9.01937 2.80491 8.98079C2.61093 8.9422 2.43275 8.84696 2.29289 8.70711C2.15304 8.56725 2.0578 8.38907 2.01922 8.19509C1.98063 8.00111 2.00043 7.80004 2.07612 7.61732C2.15181 7.43459 2.27998 7.27841 2.44443 7.16853C2.60888 7.05865 2.80222 7 3 7C3.26522 7 3.51957 7.10536 3.70711 7.29289C3.89464 7.48043 4 7.73478 4 8Z" fill="#C5C5C5"/>
|
|
||||||
<path d="M9 8C9 8.19778 8.94135 8.39112 8.83147 8.55557C8.72159 8.72002 8.56541 8.84819 8.38268 8.92388C8.19996 8.99957 7.99889 9.01937 7.80491 8.98079C7.61093 8.9422 7.43275 8.84696 7.29289 8.70711C7.15304 8.56725 7.0578 8.38907 7.01922 8.19509C6.98063 8.00111 7.00043 7.80004 7.07612 7.61732C7.15181 7.43459 7.27998 7.27841 7.44443 7.16853C7.60888 7.05865 7.80222 7 8 7C8.26522 7 8.51957 7.10536 8.70711 7.29289C8.89464 7.48043 9 7.73478 9 8Z" fill="#C5C5C5"/>
|
|
||||||
<path d="M14 8C14 8.19778 13.9414 8.39112 13.8315 8.55557C13.7216 8.72002 13.5654 8.84819 13.3827 8.92388C13.2 8.99957 12.9989 9.01937 12.8049 8.98079C12.6109 8.9422 12.4327 8.84696 12.2929 8.70711C12.153 8.56725 12.0578 8.38907 12.0192 8.19509C11.9806 8.00111 12.0004 7.80004 12.0761 7.61732C12.1518 7.43459 12.28 7.27841 12.4444 7.16853C12.6089 7.05865 12.8022 7 13 7C13.2652 7 13.5196 7.10536 13.7071 7.29289C13.8946 7.48043 14 7.73478 14 8Z" fill="#C5C5C5"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -1,5 +0,0 @@
|
|||||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M4 8C4 8.19778 3.94135 8.39112 3.83147 8.55557C3.72159 8.72002 3.56541 8.84819 3.38268 8.92388C3.19996 8.99957 2.99889 9.01937 2.80491 8.98079C2.61093 8.9422 2.43275 8.84696 2.29289 8.70711C2.15304 8.56725 2.0578 8.38907 2.01922 8.19509C1.98063 8.00111 2.00043 7.80004 2.07612 7.61732C2.15181 7.43459 2.27998 7.27841 2.44443 7.16853C2.60888 7.05865 2.80222 7 3 7C3.26522 7 3.51957 7.10536 3.70711 7.29289C3.89464 7.48043 4 7.73478 4 8Z" fill="white"/>
|
|
||||||
<path d="M9 8C9 8.19778 8.94135 8.39112 8.83147 8.55557C8.72159 8.72002 8.56541 8.84819 8.38268 8.92388C8.19996 8.99957 7.99889 9.01937 7.80491 8.98079C7.61093 8.9422 7.43275 8.84696 7.29289 8.70711C7.15304 8.56725 7.0578 8.38907 7.01922 8.19509C6.98063 8.00111 7.00043 7.80004 7.07612 7.61732C7.15181 7.43459 7.27998 7.27841 7.44443 7.16853C7.60888 7.05865 7.80222 7 8 7C8.26522 7 8.51957 7.10536 8.70711 7.29289C8.89464 7.48043 9 7.73478 9 8Z" fill="white"/>
|
|
||||||
<path d="M14 8C14 8.19778 13.9414 8.39112 13.8315 8.55557C13.7216 8.72002 13.5654 8.84819 13.3827 8.92388C13.2 8.99957 12.9989 9.01937 12.8049 8.98079C12.6109 8.9422 12.4327 8.84696 12.2929 8.70711C12.153 8.56725 12.0578 8.38907 12.0192 8.19509C11.9806 8.00111 12.0004 7.80004 12.0761 7.61732C12.1518 7.43459 12.28 7.27841 12.4444 7.16853C12.6089 7.05865 12.8022 7 13 7C13.2652 7 13.5196 7.10536 13.7071 7.29289C13.8946 7.48043 14 7.73478 14 8Z" fill="white"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -1,5 +0,0 @@
|
|||||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M4 8C4 8.19778 3.94135 8.39112 3.83147 8.55557C3.72159 8.72002 3.56541 8.84819 3.38268 8.92388C3.19996 8.99957 2.99889 9.01937 2.80491 8.98079C2.61093 8.9422 2.43275 8.84696 2.29289 8.70711C2.15304 8.56725 2.0578 8.38907 2.01922 8.19509C1.98063 8.00111 2.00043 7.80004 2.07612 7.61732C2.15181 7.43459 2.27998 7.27841 2.44443 7.16853C2.60888 7.05865 2.80222 7 3 7C3.26522 7 3.51957 7.10536 3.70711 7.29289C3.89464 7.48043 4 7.73478 4 8Z" fill="#424242"/>
|
|
||||||
<path d="M9 8C9 8.19778 8.94135 8.39112 8.83147 8.55557C8.72159 8.72002 8.56541 8.84819 8.38268 8.92388C8.19996 8.99957 7.99889 9.01937 7.80491 8.98079C7.61093 8.9422 7.43275 8.84696 7.29289 8.70711C7.15304 8.56725 7.0578 8.38907 7.01922 8.19509C6.98063 8.00111 7.00043 7.80004 7.07612 7.61732C7.15181 7.43459 7.27998 7.27841 7.44443 7.16853C7.60888 7.05865 7.80222 7 8 7C8.26522 7 8.51957 7.10536 8.70711 7.29289C8.89464 7.48043 9 7.73478 9 8Z" fill="#424242"/>
|
|
||||||
<path d="M14 8C14 8.19778 13.9414 8.39112 13.8315 8.55557C13.7216 8.72002 13.5654 8.84819 13.3827 8.92388C13.2 8.99957 12.9989 9.01937 12.8049 8.98079C12.6109 8.9422 12.4327 8.84696 12.2929 8.70711C12.153 8.56725 12.0578 8.38907 12.0192 8.19509C11.9806 8.00111 12.0004 7.80004 12.0761 7.61732C12.1518 7.43459 12.28 7.27841 12.4444 7.16853C12.6089 7.05865 12.8022 7 13 7C13.2652 7 13.5196 7.10536 13.7071 7.29289C13.8946 7.48043 14 7.73478 14 8Z" fill="#424242"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -7,15 +7,3 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vs .monaco-toolbar .action-label.toolbar-toggle-more {
|
|
||||||
background-image: url('ellipsis-light.svg');
|
|
||||||
}
|
|
||||||
|
|
||||||
.vs-dark .monaco-toolbar .action-label.toolbar-toggle-more {
|
|
||||||
background-image: url('ellipsis-dark.svg');
|
|
||||||
}
|
|
||||||
|
|
||||||
.hc-black .monaco-toolbar .action-label.toolbar-toggle-more {
|
|
||||||
background-image: url('ellipsis-hc.svg');
|
|
||||||
}
|
|
||||||
@@ -65,7 +65,7 @@ export class ToolBar extends Disposable {
|
|||||||
this.options.actionViewItemProvider,
|
this.options.actionViewItemProvider,
|
||||||
this.actionRunner,
|
this.actionRunner,
|
||||||
this.options.getKeyBinding,
|
this.options.getKeyBinding,
|
||||||
'toolbar-toggle-more',
|
'codicon-more',
|
||||||
this.options.anchorAlignmentProvider
|
this.options.anchorAlignmentProvider
|
||||||
);
|
);
|
||||||
this.toggleMenuActionViewItem.value.setActionContext(this.actionBar.context);
|
this.toggleMenuActionViewItem.value.setActionContext(this.actionBar.context);
|
||||||
|
|||||||
@@ -5,16 +5,16 @@
|
|||||||
|
|
||||||
import 'vs/css!./media/tree';
|
import 'vs/css!./media/tree';
|
||||||
import { IDisposable, dispose, Disposable, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
import { IDisposable, dispose, Disposable, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||||
import { IListOptions, List, IListStyles, mightProducePrintableCharacter, MouseController } from 'vs/base/browser/ui/list/listWidget';
|
import { IListOptions, List, IListStyles, MouseController, DefaultKeyboardNavigationDelegate } from 'vs/base/browser/ui/list/listWidget';
|
||||||
import { IListVirtualDelegate, IListRenderer, IListMouseEvent, IListEvent, IListContextMenuEvent, IListDragAndDrop, IListDragOverReaction, IKeyboardNavigationLabelProvider, IIdentityProvider } from 'vs/base/browser/ui/list/list';
|
import { IListVirtualDelegate, IListRenderer, IListMouseEvent, IListEvent, IListContextMenuEvent, IListDragAndDrop, IListDragOverReaction, IKeyboardNavigationLabelProvider, IIdentityProvider, IKeyboardNavigationDelegate } from 'vs/base/browser/ui/list/list';
|
||||||
import { append, $, toggleClass, getDomNodePagePosition, removeClass, addClass, hasClass, hasParentWithClass, createStyleSheet, clearNode } from 'vs/base/browser/dom';
|
import { append, $, toggleClass, getDomNodePagePosition, removeClass, addClass, hasClass, hasParentWithClass, createStyleSheet, clearNode } from 'vs/base/browser/dom';
|
||||||
import { Event, Relay, Emitter, EventBufferer } from 'vs/base/common/event';
|
import { Event, Relay, Emitter, EventBufferer } from 'vs/base/common/event';
|
||||||
import { StandardKeyboardEvent, IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||||
import { ITreeModel, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeFilter, ITreeNavigator, ICollapseStateChangeEvent, ITreeDragAndDrop, TreeDragOverBubble, TreeVisibility, TreeFilterResult, ITreeModelSpliceEvent, TreeMouseEventTarget } from 'vs/base/browser/ui/tree/tree';
|
import { ITreeModel, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeFilter, ITreeNavigator, ICollapseStateChangeEvent, ITreeDragAndDrop, TreeDragOverBubble, TreeVisibility, TreeFilterResult, ITreeModelSpliceEvent, TreeMouseEventTarget } from 'vs/base/browser/ui/tree/tree';
|
||||||
import { ISpliceable } from 'vs/base/common/sequence';
|
import { ISpliceable } from 'vs/base/common/sequence';
|
||||||
import { IDragAndDropData, StaticDND, DragAndDropData } from 'vs/base/browser/dnd';
|
import { IDragAndDropData, StaticDND, DragAndDropData } from 'vs/base/browser/dnd';
|
||||||
import { range, equals, distinctES6 } from 'vs/base/common/arrays';
|
import { range, equals, distinctES6, fromSet } from 'vs/base/common/arrays';
|
||||||
import { ElementsDragAndDropData } from 'vs/base/browser/ui/list/listView';
|
import { ElementsDragAndDropData } from 'vs/base/browser/ui/list/listView';
|
||||||
import { domEvent } from 'vs/base/browser/event';
|
import { domEvent } from 'vs/base/browser/event';
|
||||||
import { fuzzyScore, FuzzyScore } from 'vs/base/common/filters';
|
import { fuzzyScore, FuzzyScore } from 'vs/base/common/filters';
|
||||||
@@ -567,7 +567,7 @@ class TypeFilterController<T, TFilterData> implements IDisposable {
|
|||||||
private _empty: boolean = false;
|
private _empty: boolean = false;
|
||||||
get empty(): boolean { return this._empty; }
|
get empty(): boolean { return this._empty; }
|
||||||
|
|
||||||
private _onDidChangeEmptyState = new Emitter<boolean>();
|
private readonly _onDidChangeEmptyState = new Emitter<boolean>();
|
||||||
readonly onDidChangeEmptyState: Event<boolean> = Event.latch(this._onDidChangeEmptyState.event);
|
readonly onDidChangeEmptyState: Event<boolean> = Event.latch(this._onDidChangeEmptyState.event);
|
||||||
|
|
||||||
private positionClassName = 'ne';
|
private positionClassName = 'ne';
|
||||||
@@ -581,7 +581,7 @@ class TypeFilterController<T, TFilterData> implements IDisposable {
|
|||||||
private automaticKeyboardNavigation = true;
|
private automaticKeyboardNavigation = true;
|
||||||
private triggered = false;
|
private triggered = false;
|
||||||
|
|
||||||
private _onDidChangePattern = new Emitter<string>();
|
private readonly _onDidChangePattern = new Emitter<string>();
|
||||||
readonly onDidChangePattern = this._onDidChangePattern.event;
|
readonly onDidChangePattern = this._onDidChangePattern.event;
|
||||||
|
|
||||||
private enabledDisposables: IDisposable[] = [];
|
private enabledDisposables: IDisposable[] = [];
|
||||||
@@ -592,7 +592,7 @@ class TypeFilterController<T, TFilterData> implements IDisposable {
|
|||||||
model: ITreeModel<T, TFilterData, any>,
|
model: ITreeModel<T, TFilterData, any>,
|
||||||
private view: List<ITreeNode<T, TFilterData>>,
|
private view: List<ITreeNode<T, TFilterData>>,
|
||||||
private filter: TypeFilter<T>,
|
private filter: TypeFilter<T>,
|
||||||
private keyboardNavigationLabelProvider: IKeyboardNavigationLabelProvider<T>
|
private keyboardNavigationDelegate: IKeyboardNavigationDelegate
|
||||||
) {
|
) {
|
||||||
this.domNode = $(`.monaco-list-type-filter.${this.positionClassName}`);
|
this.domNode = $(`.monaco-list-type-filter.${this.positionClassName}`);
|
||||||
this.domNode.draggable = true;
|
this.domNode.draggable = true;
|
||||||
@@ -658,13 +658,12 @@ class TypeFilterController<T, TFilterData> implements IDisposable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isPrintableCharEvent = this.keyboardNavigationLabelProvider.mightProducePrintableCharacter ? (e: IKeyboardEvent) => this.keyboardNavigationLabelProvider.mightProducePrintableCharacter!(e) : (e: IKeyboardEvent) => mightProducePrintableCharacter(e);
|
|
||||||
const onKeyDown = Event.chain(domEvent(this.view.getHTMLElement(), 'keydown'))
|
const onKeyDown = Event.chain(domEvent(this.view.getHTMLElement(), 'keydown'))
|
||||||
.filter(e => !isInputElement(e.target as HTMLElement) || e.target === this.filterOnTypeDomNode)
|
.filter(e => !isInputElement(e.target as HTMLElement) || e.target === this.filterOnTypeDomNode)
|
||||||
.map(e => new StandardKeyboardEvent(e))
|
.map(e => new StandardKeyboardEvent(e))
|
||||||
.filter(this.keyboardNavigationEventFilter || (() => true))
|
.filter(this.keyboardNavigationEventFilter || (() => true))
|
||||||
.filter(() => this.automaticKeyboardNavigation || this.triggered)
|
.filter(() => this.automaticKeyboardNavigation || this.triggered)
|
||||||
.filter(e => isPrintableCharEvent(e) || ((this.pattern.length > 0 || this.triggered) && ((e.keyCode === KeyCode.Escape || e.keyCode === KeyCode.Backspace) && !e.altKey && !e.ctrlKey && !e.metaKey) || (e.keyCode === KeyCode.Backspace && (isMacintosh ? (e.altKey && !e.metaKey) : e.ctrlKey) && !e.shiftKey)))
|
.filter(e => this.keyboardNavigationDelegate.mightProducePrintableCharacter(e) || ((this.pattern.length > 0 || this.triggered) && ((e.keyCode === KeyCode.Escape || e.keyCode === KeyCode.Backspace) && !e.altKey && !e.ctrlKey && !e.metaKey) || (e.keyCode === KeyCode.Backspace && (isMacintosh ? (e.altKey && !e.metaKey) : e.ctrlKey) && !e.shiftKey)))
|
||||||
.forEach(e => { e.stopPropagation(); e.preventDefault(); })
|
.forEach(e => { e.stopPropagation(); e.preventDefault(); })
|
||||||
.event;
|
.event;
|
||||||
|
|
||||||
@@ -935,7 +934,7 @@ class Trait<T> {
|
|||||||
private nodes: ITreeNode<T, any>[] = [];
|
private nodes: ITreeNode<T, any>[] = [];
|
||||||
private elements: T[] | undefined;
|
private elements: T[] | undefined;
|
||||||
|
|
||||||
private _onDidChange = new Emitter<ITreeEvent<T>>();
|
private readonly _onDidChange = new Emitter<ITreeEvent<T>>();
|
||||||
readonly onDidChange = this._onDidChange.event;
|
readonly onDidChange = this._onDidChange.event;
|
||||||
|
|
||||||
private _nodeSet: Set<ITreeNode<T, any>> | undefined;
|
private _nodeSet: Set<ITreeNode<T, any>> | undefined;
|
||||||
@@ -1189,6 +1188,7 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
|
|||||||
get onDidChangeFocus(): Event<ITreeEvent<T>> { return this.eventBufferer.wrapEvent(this.focus.onDidChange); }
|
get onDidChangeFocus(): Event<ITreeEvent<T>> { return this.eventBufferer.wrapEvent(this.focus.onDidChange); }
|
||||||
get onDidChangeSelection(): Event<ITreeEvent<T>> { return this.eventBufferer.wrapEvent(this.selection.onDidChange); }
|
get onDidChangeSelection(): Event<ITreeEvent<T>> { return this.eventBufferer.wrapEvent(this.selection.onDidChange); }
|
||||||
get onDidOpen(): Event<ITreeEvent<T>> { return Event.map(this.view.onDidOpen, asTreeEvent); }
|
get onDidOpen(): Event<ITreeEvent<T>> { return Event.map(this.view.onDidOpen, asTreeEvent); }
|
||||||
|
get onDidPin(): Event<ITreeEvent<T>> { return Event.map(this.view.onDidPin, asTreeEvent); }
|
||||||
|
|
||||||
get onMouseClick(): Event<ITreeMouseEvent<T>> { return Event.map(this.view.onMouseClick, asTreeMouseEvent); }
|
get onMouseClick(): Event<ITreeMouseEvent<T>> { return Event.map(this.view.onMouseClick, asTreeMouseEvent); }
|
||||||
get onMouseDblClick(): Event<ITreeMouseEvent<T>> { return Event.map(this.view.onMouseDblClick, asTreeMouseEvent); }
|
get onMouseDblClick(): Event<ITreeMouseEvent<T>> { return Event.map(this.view.onMouseDblClick, asTreeMouseEvent); }
|
||||||
@@ -1204,7 +1204,7 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
|
|||||||
get onDidChangeCollapseState(): Event<ICollapseStateChangeEvent<T, TFilterData>> { return this.model.onDidChangeCollapseState; }
|
get onDidChangeCollapseState(): Event<ICollapseStateChangeEvent<T, TFilterData>> { return this.model.onDidChangeCollapseState; }
|
||||||
get onDidChangeRenderNodeCount(): Event<ITreeNode<T, TFilterData>> { return this.model.onDidChangeRenderNodeCount; }
|
get onDidChangeRenderNodeCount(): Event<ITreeNode<T, TFilterData>> { return this.model.onDidChangeRenderNodeCount; }
|
||||||
|
|
||||||
private _onWillRefilter = new Emitter<void>();
|
private readonly _onWillRefilter = new Emitter<void>();
|
||||||
readonly onWillRefilter: Event<void> = this._onWillRefilter.event;
|
readonly onWillRefilter: Event<void> = this._onWillRefilter.event;
|
||||||
|
|
||||||
get filterOnType(): boolean { return !!this._options.filterOnType; }
|
get filterOnType(): boolean { return !!this._options.filterOnType; }
|
||||||
@@ -1213,7 +1213,7 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
|
|||||||
get openOnSingleClick(): boolean { return typeof this._options.openOnSingleClick === 'undefined' ? true : this._options.openOnSingleClick; }
|
get openOnSingleClick(): boolean { return typeof this._options.openOnSingleClick === 'undefined' ? true : this._options.openOnSingleClick; }
|
||||||
get expandOnlyOnTwistieClick(): boolean | ((e: T) => boolean) { return typeof this._options.expandOnlyOnTwistieClick === 'undefined' ? false : this._options.expandOnlyOnTwistieClick; }
|
get expandOnlyOnTwistieClick(): boolean | ((e: T) => boolean) { return typeof this._options.expandOnlyOnTwistieClick === 'undefined' ? false : this._options.expandOnlyOnTwistieClick; }
|
||||||
|
|
||||||
private _onDidUpdateOptions = new Emitter<IAbstractTreeOptions<T, TFilterData>>();
|
private readonly _onDidUpdateOptions = new Emitter<IAbstractTreeOptions<T, TFilterData>>();
|
||||||
readonly onDidUpdateOptions: Event<IAbstractTreeOptions<T, TFilterData>> = this._onDidUpdateOptions.event;
|
readonly onDidUpdateOptions: Event<IAbstractTreeOptions<T, TFilterData>> = this._onDidUpdateOptions.event;
|
||||||
|
|
||||||
get onDidDispose(): Event<void> { return this.view.onDidDispose; }
|
get onDidDispose(): Event<void> { return this.view.onDidDispose; }
|
||||||
@@ -1228,7 +1228,7 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
|
|||||||
const treeDelegate = new ComposedTreeDelegate<T, ITreeNode<T, TFilterData>>(delegate);
|
const treeDelegate = new ComposedTreeDelegate<T, ITreeNode<T, TFilterData>>(delegate);
|
||||||
|
|
||||||
const onDidChangeCollapseStateRelay = new Relay<ICollapseStateChangeEvent<T, TFilterData>>();
|
const onDidChangeCollapseStateRelay = new Relay<ICollapseStateChangeEvent<T, TFilterData>>();
|
||||||
const onDidChangeActiveNodes = new Relay<ITreeNode<T, TFilterData>[]>();
|
const onDidChangeActiveNodes = new Emitter<ITreeNode<T, TFilterData>[]>();
|
||||||
const activeNodes = new EventCollection(onDidChangeActiveNodes.event);
|
const activeNodes = new EventCollection(onDidChangeActiveNodes.event);
|
||||||
this.disposables.push(activeNodes);
|
this.disposables.push(activeNodes);
|
||||||
|
|
||||||
@@ -1251,11 +1251,23 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
|
|||||||
onDidChangeCollapseStateRelay.input = this.model.onDidChangeCollapseState;
|
onDidChangeCollapseStateRelay.input = this.model.onDidChangeCollapseState;
|
||||||
|
|
||||||
this.model.onDidSplice(e => {
|
this.model.onDidSplice(e => {
|
||||||
|
this.eventBufferer.bufferEvents(() => {
|
||||||
this.focus.onDidModelSplice(e);
|
this.focus.onDidModelSplice(e);
|
||||||
this.selection.onDidModelSplice(e);
|
this.selection.onDidModelSplice(e);
|
||||||
}, null, this.disposables);
|
});
|
||||||
|
|
||||||
onDidChangeActiveNodes.input = Event.map(Event.any<any>(this.focus.onDidChange, this.selection.onDidChange, this.model.onDidSplice), () => [...this.focus.getNodes(), ...this.selection.getNodes()]);
|
const set = new Set<ITreeNode<T, TFilterData>>();
|
||||||
|
|
||||||
|
for (const node of this.focus.getNodes()) {
|
||||||
|
set.add(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const node of this.selection.getNodes()) {
|
||||||
|
set.add(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
onDidChangeActiveNodes.fire(fromSet(set));
|
||||||
|
}, null, this.disposables);
|
||||||
|
|
||||||
if (_options.keyboardSupport !== false) {
|
if (_options.keyboardSupport !== false) {
|
||||||
const onKeyDown = Event.chain(this.view.onKeyDown)
|
const onKeyDown = Event.chain(this.view.onKeyDown)
|
||||||
@@ -1268,7 +1280,8 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_options.keyboardNavigationLabelProvider) {
|
if (_options.keyboardNavigationLabelProvider) {
|
||||||
this.typeFilterController = new TypeFilterController(this, this.model, this.view, filter!, _options.keyboardNavigationLabelProvider);
|
const delegate = _options.keyboardNavigationDelegate || DefaultKeyboardNavigationDelegate;
|
||||||
|
this.typeFilterController = new TypeFilterController(this, this.model, this.view, filter!, delegate);
|
||||||
this.focusNavigationFilter = node => this.typeFilterController!.shouldAllowFocus(node);
|
this.focusNavigationFilter = node => this.typeFilterController!.shouldAllowFocus(node);
|
||||||
this.disposables.push(this.typeFilterController!);
|
this.disposables.push(this.typeFilterController!);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { ComposedTreeDelegate, IAbstractTreeOptions, IAbstractTreeOptionsUpdate } from 'vs/base/browser/ui/tree/abstractTree';
|
import { ComposedTreeDelegate, IAbstractTreeOptions, IAbstractTreeOptionsUpdate } from 'vs/base/browser/ui/tree/abstractTree';
|
||||||
import { ObjectTree, IObjectTreeOptions, CompressibleObjectTree, ICompressibleTreeRenderer } from 'vs/base/browser/ui/tree/objectTree';
|
import { ObjectTree, IObjectTreeOptions, CompressibleObjectTree, ICompressibleTreeRenderer, ICompressibleKeyboardNavigationLabelProvider, ICompressibleObjectTreeOptions } from 'vs/base/browser/ui/tree/objectTree';
|
||||||
import { IListVirtualDelegate, IIdentityProvider, IListDragAndDrop, IListDragOverReaction } from 'vs/base/browser/ui/list/list';
|
import { IListVirtualDelegate, IIdentityProvider, IListDragAndDrop, IListDragOverReaction } from 'vs/base/browser/ui/list/list';
|
||||||
import { ITreeElement, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeSorter, ICollapseStateChangeEvent, IAsyncDataSource, ITreeDragAndDrop, TreeError, WeakMapper } from 'vs/base/browser/ui/tree/tree';
|
import { ITreeElement, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeSorter, ICollapseStateChangeEvent, IAsyncDataSource, ITreeDragAndDrop, TreeError, WeakMapper } from 'vs/base/browser/ui/tree/tree';
|
||||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||||
@@ -1010,6 +1010,24 @@ export interface ITreeCompressionDelegate<T> {
|
|||||||
isIncompressible(element: T): boolean;
|
isIncompressible(element: T): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function asCompressibleObjectTreeOptions<TInput, T, TFilterData>(options?: ICompressibleAsyncDataTreeOptions<T, TFilterData>): ICompressibleObjectTreeOptions<IAsyncDataTreeNode<TInput, T>, TFilterData> | undefined {
|
||||||
|
const objectTreeOptions = options && asObjectTreeOptions(options);
|
||||||
|
|
||||||
|
return objectTreeOptions && {
|
||||||
|
...objectTreeOptions,
|
||||||
|
keyboardNavigationLabelProvider: objectTreeOptions.keyboardNavigationLabelProvider && {
|
||||||
|
...objectTreeOptions.keyboardNavigationLabelProvider,
|
||||||
|
getCompressedNodeKeyboardNavigationLabel(els) {
|
||||||
|
return options!.keyboardNavigationLabelProvider!.getCompressedNodeKeyboardNavigationLabel(els.map(e => e.element as T));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICompressibleAsyncDataTreeOptions<T, TFilterData = void> extends IAsyncDataTreeOptions<T, TFilterData> {
|
||||||
|
readonly keyboardNavigationLabelProvider?: ICompressibleKeyboardNavigationLabelProvider<T>;
|
||||||
|
}
|
||||||
|
|
||||||
export class CompressibleAsyncDataTree<TInput, T, TFilterData = void> extends AsyncDataTree<TInput, T, TFilterData> {
|
export class CompressibleAsyncDataTree<TInput, T, TFilterData = void> extends AsyncDataTree<TInput, T, TFilterData> {
|
||||||
|
|
||||||
protected readonly compressibleNodeMapper: CompressibleAsyncDataTreeNodeMapper<TInput, T, TFilterData> = new WeakMapper(node => new CompressibleAsyncDataTreeNodeWrapper(node));
|
protected readonly compressibleNodeMapper: CompressibleAsyncDataTreeNodeMapper<TInput, T, TFilterData> = new WeakMapper(node => new CompressibleAsyncDataTreeNodeWrapper(node));
|
||||||
@@ -1031,11 +1049,11 @@ export class CompressibleAsyncDataTree<TInput, T, TFilterData = void> extends As
|
|||||||
container: HTMLElement,
|
container: HTMLElement,
|
||||||
delegate: IListVirtualDelegate<T>,
|
delegate: IListVirtualDelegate<T>,
|
||||||
renderers: ICompressibleTreeRenderer<T, TFilterData, any>[],
|
renderers: ICompressibleTreeRenderer<T, TFilterData, any>[],
|
||||||
options: IAsyncDataTreeOptions<T, TFilterData>
|
options: ICompressibleAsyncDataTreeOptions<T, TFilterData>
|
||||||
): ObjectTree<IAsyncDataTreeNode<TInput, T>, TFilterData> {
|
): ObjectTree<IAsyncDataTreeNode<TInput, T>, TFilterData> {
|
||||||
const objectTreeDelegate = new ComposedTreeDelegate<TInput | T, IAsyncDataTreeNode<TInput, T>>(delegate);
|
const objectTreeDelegate = new ComposedTreeDelegate<TInput | T, IAsyncDataTreeNode<TInput, T>>(delegate);
|
||||||
const objectTreeRenderers = renderers.map(r => new CompressibleAsyncDataTreeRenderer(r, this.nodeMapper, () => this.compressibleNodeMapper, this._onDidChangeNodeSlowState.event));
|
const objectTreeRenderers = renderers.map(r => new CompressibleAsyncDataTreeRenderer(r, this.nodeMapper, () => this.compressibleNodeMapper, this._onDidChangeNodeSlowState.event));
|
||||||
const objectTreeOptions = asObjectTreeOptions<TInput, T, TFilterData>(options) || {};
|
const objectTreeOptions = asCompressibleObjectTreeOptions<TInput, T, TFilterData>(options) || {};
|
||||||
|
|
||||||
return new CompressibleObjectTree(user, container, objectTreeDelegate, objectTreeRenderers, objectTreeOptions);
|
return new CompressibleObjectTree(user, container, objectTreeDelegate, objectTreeRenderers, objectTreeOptions);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ function mapOptions<T, TFilterData>(compressedNodeUnwrapper: CompressedNodeUnwra
|
|||||||
...options,
|
...options,
|
||||||
sorter: options.sorter && {
|
sorter: options.sorter && {
|
||||||
compare(node: ICompressedTreeNode<T>, otherNode: ICompressedTreeNode<T>): number {
|
compare(node: ICompressedTreeNode<T>, otherNode: ICompressedTreeNode<T>): number {
|
||||||
return options.sorter!.compare(compressedNodeUnwrapper(node), compressedNodeUnwrapper(otherNode));
|
return options.sorter!.compare(node.elements[0], otherNode.elements[0]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
identityProvider: options.identityProvider && {
|
identityProvider: options.identityProvider && {
|
||||||
|
|||||||
@@ -162,9 +162,10 @@ export class DataTree<TInput, T, TFilterData = void> extends AbstractTree<T | nu
|
|||||||
const children = this.dataSource.getChildren(element);
|
const children = this.dataSource.getChildren(element);
|
||||||
const elements = Iterator.map<any, ITreeElement<T>>(Iterator.fromArray(children), element => {
|
const elements = Iterator.map<any, ITreeElement<T>>(Iterator.fromArray(children), element => {
|
||||||
const { elements: children, size } = this.iterate(element, isCollapsed);
|
const { elements: children, size } = this.iterate(element, isCollapsed);
|
||||||
|
const collapsible = this.dataSource.hasChildren ? this.dataSource.hasChildren(element) : undefined;
|
||||||
const collapsed = size === 0 ? undefined : (isCollapsed && isCollapsed(element));
|
const collapsed = size === 0 ? undefined : (isCollapsed && isCollapsed(element));
|
||||||
|
|
||||||
return { element, children, collapsed };
|
return { element, children, collapsible, collapsed };
|
||||||
});
|
});
|
||||||
|
|
||||||
return { elements, size: children.length };
|
return { elements, size: children.length };
|
||||||
|
|||||||
@@ -62,17 +62,17 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
|
|||||||
private root: IIndexTreeNode<T, TFilterData>;
|
private root: IIndexTreeNode<T, TFilterData>;
|
||||||
private eventBufferer = new EventBufferer();
|
private eventBufferer = new EventBufferer();
|
||||||
|
|
||||||
private _onDidChangeCollapseState = new Emitter<ICollapseStateChangeEvent<T, TFilterData>>();
|
private readonly _onDidChangeCollapseState = new Emitter<ICollapseStateChangeEvent<T, TFilterData>>();
|
||||||
readonly onDidChangeCollapseState: Event<ICollapseStateChangeEvent<T, TFilterData>> = this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event);
|
readonly onDidChangeCollapseState: Event<ICollapseStateChangeEvent<T, TFilterData>> = this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event);
|
||||||
|
|
||||||
private _onDidChangeRenderNodeCount = new Emitter<ITreeNode<T, TFilterData>>();
|
private readonly _onDidChangeRenderNodeCount = new Emitter<ITreeNode<T, TFilterData>>();
|
||||||
readonly onDidChangeRenderNodeCount: Event<ITreeNode<T, TFilterData>> = this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event);
|
readonly onDidChangeRenderNodeCount: Event<ITreeNode<T, TFilterData>> = this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event);
|
||||||
|
|
||||||
private collapseByDefault: boolean;
|
private collapseByDefault: boolean;
|
||||||
private filter?: ITreeFilter<T, TFilterData>;
|
private filter?: ITreeFilter<T, TFilterData>;
|
||||||
private autoExpandSingleChildren: boolean;
|
private autoExpandSingleChildren: boolean;
|
||||||
|
|
||||||
private _onDidSplice = new Emitter<ITreeModelSpliceEvent<T, TFilterData>>();
|
private readonly _onDidSplice = new Emitter<ITreeModelSpliceEvent<T, TFilterData>>();
|
||||||
readonly onDidSplice = this._onDidSplice.event;
|
readonly onDidSplice = this._onDidSplice.event;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -169,7 +169,7 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
|
|||||||
parentNode.visibleChildrenCount += insertedVisibleChildrenCount - deletedVisibleChildrenCount;
|
parentNode.visibleChildrenCount += insertedVisibleChildrenCount - deletedVisibleChildrenCount;
|
||||||
|
|
||||||
if (revealed && visible) {
|
if (revealed && visible) {
|
||||||
const visibleDeleteCount = deletedNodes.reduce((r, node) => r + node.renderNodeCount, 0);
|
const visibleDeleteCount = deletedNodes.reduce((r, node) => r + (node.visible ? node.renderNodeCount : 0), 0);
|
||||||
|
|
||||||
this._updateAncestorsRenderNodeCount(parentNode, renderNodeCount - visibleDeleteCount);
|
this._updateAncestorsRenderNodeCount(parentNode, renderNodeCount - visibleDeleteCount);
|
||||||
this.list.splice(listIndex, visibleDeleteCount, treeListElementsToInsert);
|
this.list.splice(listIndex, visibleDeleteCount, treeListElementsToInsert);
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ import { AbstractTree, IAbstractTreeOptions } from 'vs/base/browser/ui/tree/abst
|
|||||||
import { ISpliceable } from 'vs/base/common/sequence';
|
import { ISpliceable } from 'vs/base/common/sequence';
|
||||||
import { ITreeNode, ITreeModel, ITreeElement, ITreeRenderer, ITreeSorter, ICollapseStateChangeEvent } from 'vs/base/browser/ui/tree/tree';
|
import { ITreeNode, ITreeModel, ITreeElement, ITreeRenderer, ITreeSorter, ICollapseStateChangeEvent } from 'vs/base/browser/ui/tree/tree';
|
||||||
import { ObjectTreeModel, IObjectTreeModel } from 'vs/base/browser/ui/tree/objectTreeModel';
|
import { ObjectTreeModel, IObjectTreeModel } from 'vs/base/browser/ui/tree/objectTreeModel';
|
||||||
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
|
import { IListVirtualDelegate, IKeyboardNavigationLabelProvider } from 'vs/base/browser/ui/list/list';
|
||||||
import { Event } from 'vs/base/common/event';
|
import { Event } from 'vs/base/common/event';
|
||||||
import { CompressibleObjectTreeModel, ElementMapper, ICompressedTreeNode, ICompressedTreeElement } from 'vs/base/browser/ui/tree/compressedObjectTreeModel';
|
import { CompressibleObjectTreeModel, ElementMapper, ICompressedTreeNode, ICompressedTreeElement } from 'vs/base/browser/ui/tree/compressedObjectTreeModel';
|
||||||
|
import { memoize } from 'vs/base/common/decorators';
|
||||||
|
|
||||||
export interface IObjectTreeOptions<T, TFilterData = void> extends IAbstractTreeOptions<T, TFilterData> {
|
export interface IObjectTreeOptions<T, TFilterData = void> extends IAbstractTreeOptions<T, TFilterData> {
|
||||||
sorter?: ITreeSorter<T>;
|
sorter?: ITreeSorter<T>;
|
||||||
@@ -77,9 +78,12 @@ class CompressibleRenderer<T, TFilterData, TTemplateData> implements ITreeRender
|
|||||||
readonly templateId: string;
|
readonly templateId: string;
|
||||||
readonly onDidChangeTwistieState: Event<T> | undefined;
|
readonly onDidChangeTwistieState: Event<T> | undefined;
|
||||||
|
|
||||||
compressedTreeNodeProvider: ICompressedTreeNodeProvider<T, TFilterData>;
|
@memoize
|
||||||
|
private get compressedTreeNodeProvider(): ICompressedTreeNodeProvider<T, TFilterData> {
|
||||||
|
return this._compressedTreeNodeProvider();
|
||||||
|
}
|
||||||
|
|
||||||
constructor(private renderer: ICompressibleTreeRenderer<T, TFilterData, TTemplateData>) {
|
constructor(private _compressedTreeNodeProvider: () => ICompressedTreeNodeProvider<T, TFilterData>, private renderer: ICompressibleTreeRenderer<T, TFilterData, TTemplateData>) {
|
||||||
this.templateId = renderer.templateId;
|
this.templateId = renderer.templateId;
|
||||||
|
|
||||||
if (renderer.onDidChangeTwistieState) {
|
if (renderer.onDidChangeTwistieState) {
|
||||||
@@ -127,7 +131,38 @@ class CompressibleRenderer<T, TFilterData, TTemplateData> implements ITreeRender
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CompressibleObjectTree<T extends NonNullable<any>, TFilterData = void> extends ObjectTree<T, TFilterData> {
|
export interface ICompressibleKeyboardNavigationLabelProvider<T> extends IKeyboardNavigationLabelProvider<T> {
|
||||||
|
getCompressedNodeKeyboardNavigationLabel(elements: T[]): { toString(): string | undefined; } | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICompressibleObjectTreeOptions<T, TFilterData = void> extends IObjectTreeOptions<T, TFilterData> {
|
||||||
|
readonly keyboardNavigationLabelProvider?: ICompressibleKeyboardNavigationLabelProvider<T>;
|
||||||
|
}
|
||||||
|
|
||||||
|
function asObjectTreeOptions<T, TFilterData>(compressedTreeNodeProvider: () => ICompressedTreeNodeProvider<T, TFilterData>, options?: ICompressibleObjectTreeOptions<T, TFilterData>): IObjectTreeOptions<T, TFilterData> | undefined {
|
||||||
|
return options && {
|
||||||
|
...options,
|
||||||
|
keyboardNavigationLabelProvider: options.keyboardNavigationLabelProvider && {
|
||||||
|
getKeyboardNavigationLabel(e: T) {
|
||||||
|
let compressedTreeNode: ITreeNode<ICompressedTreeNode<T>, TFilterData>;
|
||||||
|
|
||||||
|
try {
|
||||||
|
compressedTreeNode = compressedTreeNodeProvider().getCompressedTreeNode(e);
|
||||||
|
} catch {
|
||||||
|
return options.keyboardNavigationLabelProvider!.getKeyboardNavigationLabel(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (compressedTreeNode.element.elements.length === 1) {
|
||||||
|
return options.keyboardNavigationLabelProvider!.getKeyboardNavigationLabel(e);
|
||||||
|
} else {
|
||||||
|
return options.keyboardNavigationLabelProvider!.getCompressedNodeKeyboardNavigationLabel(compressedTreeNode.element.elements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CompressibleObjectTree<T extends NonNullable<any>, TFilterData = void> extends ObjectTree<T, TFilterData> implements ICompressedTreeNodeProvider<T, TFilterData> {
|
||||||
|
|
||||||
protected model: CompressibleObjectTreeModel<T, TFilterData>;
|
protected model: CompressibleObjectTreeModel<T, TFilterData>;
|
||||||
|
|
||||||
@@ -136,11 +171,11 @@ export class CompressibleObjectTree<T extends NonNullable<any>, TFilterData = vo
|
|||||||
container: HTMLElement,
|
container: HTMLElement,
|
||||||
delegate: IListVirtualDelegate<T>,
|
delegate: IListVirtualDelegate<T>,
|
||||||
renderers: ICompressibleTreeRenderer<T, TFilterData, any>[],
|
renderers: ICompressibleTreeRenderer<T, TFilterData, any>[],
|
||||||
options: IObjectTreeOptions<T, TFilterData> = {}
|
options: ICompressibleObjectTreeOptions<T, TFilterData> = {}
|
||||||
) {
|
) {
|
||||||
const compressibleRenderers = renderers.map(r => new CompressibleRenderer(r));
|
const compressedTreeNodeProvider = () => this;
|
||||||
super(user, container, delegate, compressibleRenderers, options);
|
const compressibleRenderers = renderers.map(r => new CompressibleRenderer(compressedTreeNodeProvider, r));
|
||||||
compressibleRenderers.forEach(r => r.compressedTreeNodeProvider = this);
|
super(user, container, delegate, compressibleRenderers, asObjectTreeOptions(compressedTreeNodeProvider, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
setChildren(element: T | null, children?: ISequence<ICompressedTreeElement<T>>): void {
|
setChildren(element: T | null, children?: ISequence<ICompressedTreeElement<T>>): void {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { IndexTreeModel, IIndexTreeModelOptions } from 'vs/base/browser/ui/tree/
|
|||||||
import { Event } from 'vs/base/common/event';
|
import { Event } from 'vs/base/common/event';
|
||||||
import { ITreeModel, ITreeNode, ITreeElement, ITreeSorter, ICollapseStateChangeEvent, ITreeModelSpliceEvent, TreeError } from 'vs/base/browser/ui/tree/tree';
|
import { ITreeModel, ITreeNode, ITreeElement, ITreeSorter, ICollapseStateChangeEvent, ITreeModelSpliceEvent, TreeError } from 'vs/base/browser/ui/tree/tree';
|
||||||
import { IIdentityProvider } from 'vs/base/browser/ui/list/list';
|
import { IIdentityProvider } from 'vs/base/browser/ui/list/list';
|
||||||
|
import { mergeSort } from 'vs/base/common/arrays';
|
||||||
|
|
||||||
export type ITreeNodeCallback<T, TFilterData> = (node: ITreeNode<T, TFilterData>) => void;
|
export type ITreeNodeCallback<T, TFilterData> = (node: ITreeNode<T, TFilterData>) => void;
|
||||||
|
|
||||||
@@ -123,7 +124,7 @@ export class ObjectTreeModel<T extends NonNullable<any>, TFilterData extends Non
|
|||||||
let iterator = elements ? getSequenceIterator(elements) : Iterator.empty<ITreeElement<T>>();
|
let iterator = elements ? getSequenceIterator(elements) : Iterator.empty<ITreeElement<T>>();
|
||||||
|
|
||||||
if (this.sorter) {
|
if (this.sorter) {
|
||||||
iterator = Iterator.fromArray(Iterator.collect(iterator).sort(this.sorter.compare.bind(this.sorter)));
|
iterator = Iterator.fromArray(mergeSort(Iterator.collect(iterator), this.sorter.compare.bind(this.sorter)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Iterator.map(iterator, treeElement => {
|
return Iterator.map(iterator, treeElement => {
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ export interface ITreeNavigator<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IDataSource<TInput, T> {
|
export interface IDataSource<TInput, T> {
|
||||||
|
hasChildren?(element: TInput | T): boolean;
|
||||||
getChildren(element: TInput | T): T[];
|
getChildren(element: TInput | T): T[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export function getPathFromAmdModule(requirefn: typeof require, relativePath: st
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference a resource that might be inlined.
|
* Reference a resource that might be inlined.
|
||||||
|
* Do not inline icons that will be used by the native mac touchbar.
|
||||||
* Do not rename this method unless you adopt the build scripts.
|
* Do not rename this method unless you adopt the build scripts.
|
||||||
*/
|
*/
|
||||||
export function registerAndGetAmdImageURL(absolutePath: string): string {
|
export function registerAndGetAmdImageURL(absolutePath: string): string {
|
||||||
|
|||||||
@@ -372,6 +372,12 @@ export function distinctES6<T>(array: ReadonlyArray<T>): T[] {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fromSet<T>(set: Set<T>): T[] {
|
||||||
|
const result: T[] = [];
|
||||||
|
set.forEach(o => result.push(o));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
export function uniqueFilter<T>(keyFn: (t: T) => string): (t: T) => boolean {
|
export function uniqueFilter<T>(keyFn: (t: T) => string): (t: T) => boolean {
|
||||||
const seen: { [key: string]: boolean; } = Object.create(null);
|
const seen: { [key: string]: boolean; } = Object.create(null);
|
||||||
|
|
||||||
@@ -418,6 +424,12 @@ export function first<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean, notF
|
|||||||
return index < 0 ? notFoundValue : array[index];
|
return index < 0 ? notFoundValue : array[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function firstOrDefault<T, NotFound = T>(array: ReadonlyArray<T>, notFoundValue: NotFound): T | NotFound;
|
||||||
|
export function firstOrDefault<T>(array: ReadonlyArray<T>): T | undefined;
|
||||||
|
export function firstOrDefault<T, NotFound = T>(array: ReadonlyArray<T>, notFoundValue?: NotFound): T | NotFound | undefined {
|
||||||
|
return array.length > 0 ? array[0] : notFoundValue;
|
||||||
|
}
|
||||||
|
|
||||||
export function commonPrefixLength<T>(one: ReadonlyArray<T>, other: ReadonlyArray<T>, equals: (a: T, b: T) => boolean = (a, b) => a === b): number {
|
export function commonPrefixLength<T>(one: ReadonlyArray<T>, other: ReadonlyArray<T>, equals: (a: T, b: T) => boolean = (a, b) => a === b): number {
|
||||||
let result = 0;
|
let result = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,12 @@ export function fromMap<T>(original: Map<string, T>): IStringDictionary<T> {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function mapValues<V>(map: Map<any, V>): V[] {
|
||||||
|
const result: V[] = [];
|
||||||
|
map.forEach(v => result.push(v));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
export class SetMap<K, V> {
|
export class SetMap<K, V> {
|
||||||
|
|
||||||
private map = new Map<K, Set<V>>();
|
private map = new Map<K, Set<V>>();
|
||||||
|
|||||||
@@ -24,7 +24,12 @@ export function createDecorator(mapFn: (fn: Function, key: string) => Function):
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function memoize(target: any, key: string, descriptor: any) {
|
let memoizeId = 0;
|
||||||
|
export function createMemoizer() {
|
||||||
|
const memoizeKeyPrefix = `$memoize${memoizeId++}`;
|
||||||
|
let self: any = undefined;
|
||||||
|
|
||||||
|
const result = function memoize(target: any, key: string, descriptor: any) {
|
||||||
let fnKey: string | null = null;
|
let fnKey: string | null = null;
|
||||||
let fn: Function | null = null;
|
let fn: Function | null = null;
|
||||||
|
|
||||||
@@ -44,20 +49,39 @@ export function memoize(target: any, key: string, descriptor: any) {
|
|||||||
throw new Error('not supported');
|
throw new Error('not supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
const memoizeKey = `$memoize$${key}`;
|
const memoizeKey = `${memoizeKeyPrefix}:${key}`;
|
||||||
|
|
||||||
descriptor[fnKey!] = function (...args: any[]) {
|
descriptor[fnKey!] = function (...args: any[]) {
|
||||||
|
self = this;
|
||||||
|
|
||||||
if (!this.hasOwnProperty(memoizeKey)) {
|
if (!this.hasOwnProperty(memoizeKey)) {
|
||||||
Object.defineProperty(this, memoizeKey, {
|
Object.defineProperty(this, memoizeKey, {
|
||||||
configurable: false,
|
configurable: true,
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
writable: false,
|
writable: true,
|
||||||
value: fn!.apply(this, args)
|
value: fn!.apply(this, args)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return this[memoizeKey];
|
return this[memoizeKey];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
result.clear = () => {
|
||||||
|
if (typeof self === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Object.getOwnPropertyNames(self).forEach(property => {
|
||||||
|
if (property.indexOf(memoizeKeyPrefix) === 0) {
|
||||||
|
delete self[property];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function memoize(target: any, key: string, descriptor: any) {
|
||||||
|
return createMemoizer()(target, key, descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDebouceReducer<T> {
|
export interface IDebouceReducer<T> {
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ class LeakageMonitor {
|
|||||||
* Sample:
|
* Sample:
|
||||||
class Document {
|
class Document {
|
||||||
|
|
||||||
private _onDidChange = new Emitter<(value:string)=>any>();
|
private readonly _onDidChange = new Emitter<(value:string)=>any>();
|
||||||
|
|
||||||
public onDidChange = this._onDidChange.event;
|
public onDidChange = this._onDidChange.event;
|
||||||
|
|
||||||
@@ -808,7 +808,7 @@ export class Relay<T> implements IDisposable {
|
|||||||
private inputEvent: Event<T> = Event.None;
|
private inputEvent: Event<T> = Event.None;
|
||||||
private inputEventListener: IDisposable = Disposable.None;
|
private inputEventListener: IDisposable = Disposable.None;
|
||||||
|
|
||||||
private emitter = new Emitter<T>({
|
private readonly emitter = new Emitter<T>({
|
||||||
onFirstListenerDidAdd: () => {
|
onFirstListenerDidAdd: () => {
|
||||||
this.listening = true;
|
this.listening = true;
|
||||||
this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);
|
this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export class HistoryNavigator<T> implements INavigator<T> {
|
|||||||
private _limit: number;
|
private _limit: number;
|
||||||
private _navigator!: ArrayNavigator<T>;
|
private _navigator!: ArrayNavigator<T>;
|
||||||
|
|
||||||
constructor(history: T[] = [], limit: number = 10) {
|
constructor(history: readonly T[] = [], limit: number = 10) {
|
||||||
this._initialize(history);
|
this._initialize(history);
|
||||||
this._limit = limit;
|
this._limit = limit;
|
||||||
this._onChange();
|
this._onChange();
|
||||||
@@ -62,7 +62,8 @@ export class HistoryNavigator<T> implements INavigator<T> {
|
|||||||
|
|
||||||
private _onChange() {
|
private _onChange() {
|
||||||
this._reduceToLimit();
|
this._reduceToLimit();
|
||||||
this._navigator = new ArrayNavigator(this._elements, 0, this._elements.length, this._elements.length);
|
const elements = this._elements;
|
||||||
|
this._navigator = new ArrayNavigator(elements, 0, elements.length, elements.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _reduceToLimit() {
|
private _reduceToLimit() {
|
||||||
@@ -72,7 +73,7 @@ export class HistoryNavigator<T> implements INavigator<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _initialize(history: T[]): void {
|
private _initialize(history: readonly T[]): void {
|
||||||
this._history = new Set();
|
this._history = new Set();
|
||||||
for (const entry of history) {
|
for (const entry of history) {
|
||||||
this._history.add(entry);
|
this._history.add(entry);
|
||||||
|
|||||||
@@ -18,6 +18,22 @@ export interface Iterator<T> {
|
|||||||
next(): IteratorResult<T>;
|
next(): IteratorResult<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface NativeIteratorYieldResult<TYield> {
|
||||||
|
done?: false;
|
||||||
|
value: TYield;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NativeIteratorReturnResult<TReturn> {
|
||||||
|
done: true;
|
||||||
|
value: TReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
type NativeIteratorResult<T, TReturn = any> = NativeIteratorYieldResult<T> | NativeIteratorReturnResult<TReturn>;
|
||||||
|
|
||||||
|
export interface NativeIterator<T> {
|
||||||
|
next(): NativeIteratorResult<T>;
|
||||||
|
}
|
||||||
|
|
||||||
export module Iterator {
|
export module Iterator {
|
||||||
const _empty: Iterator<any> = {
|
const _empty: Iterator<any> = {
|
||||||
next() {
|
next() {
|
||||||
@@ -56,6 +72,20 @@ export module Iterator {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fromNativeIterator<T>(it: NativeIterator<T>): Iterator<T> {
|
||||||
|
return {
|
||||||
|
next(): IteratorResult<T> {
|
||||||
|
const result = it.next();
|
||||||
|
|
||||||
|
if (result.done) {
|
||||||
|
return FIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { done: false, value: result.value };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function from<T>(elements: Iterator<T> | T[] | undefined): Iterator<T> {
|
export function from<T>(elements: Iterator<T> | T[] | undefined): Iterator<T> {
|
||||||
if (!elements) {
|
if (!elements) {
|
||||||
return Iterator.empty();
|
return Iterator.empty();
|
||||||
@@ -160,12 +190,12 @@ export interface INextIterator<T> {
|
|||||||
|
|
||||||
export class ArrayIterator<T> implements INextIterator<T> {
|
export class ArrayIterator<T> implements INextIterator<T> {
|
||||||
|
|
||||||
private items: T[];
|
private readonly items: readonly T[];
|
||||||
protected start: number;
|
protected start: number;
|
||||||
protected end: number;
|
protected end: number;
|
||||||
protected index: number;
|
protected index: number;
|
||||||
|
|
||||||
constructor(items: T[], start: number = 0, end: number = items.length, index = start - 1) {
|
constructor(items: readonly T[], start: number = 0, end: number = items.length, index = start - 1) {
|
||||||
this.items = items;
|
this.items = items;
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
@@ -193,7 +223,7 @@ export class ArrayIterator<T> implements INextIterator<T> {
|
|||||||
|
|
||||||
export class ArrayNavigator<T> extends ArrayIterator<T> implements INavigator<T> {
|
export class ArrayNavigator<T> extends ArrayIterator<T> implements INavigator<T> {
|
||||||
|
|
||||||
constructor(items: T[], start: number = 0, end: number = items.length, index = start - 1) {
|
constructor(items: readonly T[], start: number = 0, end: number = items.length, index = start - 1) {
|
||||||
super(items, start, end, index);
|
super(items, start, end, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export interface IJSONSchema {
|
|||||||
markdownDescription?: string; // VSCode extension
|
markdownDescription?: string; // VSCode extension
|
||||||
doNotSuggest?: boolean; // VSCode extension
|
doNotSuggest?: boolean; // VSCode extension
|
||||||
allowComments?: boolean; // VSCode extension
|
allowComments?: boolean; // VSCode extension
|
||||||
allowsTrailingCommas?: boolean; // VSCode extension
|
allowTrailingCommas?: boolean; // VSCode extension
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IJSONSchemaMap {
|
export interface IJSONSchemaMap {
|
||||||
|
|||||||
@@ -0,0 +1,191 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import { memoize } from 'vs/base/common/decorators';
|
||||||
|
import * as paths from 'vs/base/common/path';
|
||||||
|
import { Iterator } from 'vs/base/common/iterator';
|
||||||
|
import { relativePath, joinPath } from 'vs/base/common/resources';
|
||||||
|
import { URI } from 'vs/base/common/uri';
|
||||||
|
import { mapValues } from 'vs/base/common/collections';
|
||||||
|
|
||||||
|
export interface ILeafNode<T, C = void> {
|
||||||
|
readonly uri: URI;
|
||||||
|
readonly relativePath: string;
|
||||||
|
readonly name: string;
|
||||||
|
readonly element: T;
|
||||||
|
readonly context: C;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IBranchNode<T, C = void> {
|
||||||
|
readonly uri: URI;
|
||||||
|
readonly relativePath: string;
|
||||||
|
readonly name: string;
|
||||||
|
readonly size: number;
|
||||||
|
readonly children: Iterator<INode<T, C>>;
|
||||||
|
readonly parent: IBranchNode<T, C> | undefined;
|
||||||
|
readonly context: C;
|
||||||
|
get(childName: string): INode<T, C> | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type INode<T, C> = IBranchNode<T, C> | ILeafNode<T, C>;
|
||||||
|
|
||||||
|
// Internals
|
||||||
|
|
||||||
|
class Node<C> {
|
||||||
|
|
||||||
|
@memoize
|
||||||
|
get name(): string { return paths.posix.basename(this.relativePath); }
|
||||||
|
|
||||||
|
constructor(readonly uri: URI, readonly relativePath: string, readonly context: C) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
class BranchNode<T, C> extends Node<C> implements IBranchNode<T, C> {
|
||||||
|
|
||||||
|
private _children = new Map<string, BranchNode<T, C> | LeafNode<T, C>>();
|
||||||
|
|
||||||
|
get size(): number {
|
||||||
|
return this._children.size;
|
||||||
|
}
|
||||||
|
|
||||||
|
get children(): Iterator<BranchNode<T, C> | LeafNode<T, C>> {
|
||||||
|
return Iterator.fromArray(mapValues(this._children));
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(uri: URI, relativePath: string, context: C, readonly parent: IBranchNode<T, C> | undefined = undefined) {
|
||||||
|
super(uri, relativePath, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
get(path: string): BranchNode<T, C> | LeafNode<T, C> | undefined {
|
||||||
|
return this._children.get(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
set(path: string, child: BranchNode<T, C> | LeafNode<T, C>): void {
|
||||||
|
this._children.set(path, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(path: string): void {
|
||||||
|
this._children.delete(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LeafNode<T, C> extends Node<C> implements ILeafNode<T, C> {
|
||||||
|
|
||||||
|
constructor(uri: URI, path: string, context: C, readonly element: T) {
|
||||||
|
super(uri, path, context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function collect<T, C>(node: INode<T, C>, result: T[]): T[] {
|
||||||
|
if (ResourceTree.isBranchNode(node)) {
|
||||||
|
Iterator.forEach(node.children, child => collect(child, result));
|
||||||
|
} else {
|
||||||
|
result.push(node.element);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ResourceTree<T extends NonNullable<any>, C> {
|
||||||
|
|
||||||
|
readonly root: BranchNode<T, C>;
|
||||||
|
|
||||||
|
static isBranchNode<T, C>(obj: any): obj is IBranchNode<T, C> {
|
||||||
|
return obj instanceof BranchNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
static getRoot<T, C>(node: IBranchNode<T, C>): IBranchNode<T, C> {
|
||||||
|
while (node.parent) {
|
||||||
|
node = node.parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
static collect<T, C>(node: INode<T, C>): T[] {
|
||||||
|
return collect(node, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(context: C, rootURI: URI = URI.file('/')) {
|
||||||
|
this.root = new BranchNode(rootURI, '', context);
|
||||||
|
}
|
||||||
|
|
||||||
|
add(uri: URI, element: T): void {
|
||||||
|
const key = relativePath(this.root.uri, uri) || uri.fsPath;
|
||||||
|
const parts = key.split(/[\\\/]/).filter(p => !!p);
|
||||||
|
let node = this.root;
|
||||||
|
let path = '';
|
||||||
|
|
||||||
|
for (let i = 0; i < parts.length; i++) {
|
||||||
|
const name = parts[i];
|
||||||
|
path = path + '/' + name;
|
||||||
|
|
||||||
|
let child = node.get(name);
|
||||||
|
|
||||||
|
if (!child) {
|
||||||
|
if (i < parts.length - 1) {
|
||||||
|
child = new BranchNode(joinPath(this.root.uri, path), path, this.root.context, node);
|
||||||
|
node.set(name, child);
|
||||||
|
} else {
|
||||||
|
child = new LeafNode(uri, path, this.root.context, element);
|
||||||
|
node.set(name, child);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(child instanceof BranchNode)) {
|
||||||
|
if (i < parts.length - 1) {
|
||||||
|
throw new Error('Inconsistent tree: can\'t override leaf with branch.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace
|
||||||
|
node.set(name, new LeafNode(uri, path, this.root.context, element));
|
||||||
|
return;
|
||||||
|
} else if (i === parts.length - 1) {
|
||||||
|
throw new Error('Inconsistent tree: can\'t override branch with leaf.');
|
||||||
|
}
|
||||||
|
|
||||||
|
node = child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(uri: URI): T | undefined {
|
||||||
|
const key = relativePath(this.root.uri, uri) || uri.fsPath;
|
||||||
|
const parts = key.split(/[\\\/]/).filter(p => !!p);
|
||||||
|
return this._delete(this.root, parts, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private _delete(node: BranchNode<T, C>, parts: string[], index: number): T | undefined {
|
||||||
|
const name = parts[index];
|
||||||
|
const child = node.get(name);
|
||||||
|
|
||||||
|
if (!child) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
// not at end
|
||||||
|
if (index < parts.length - 1) {
|
||||||
|
if (child instanceof BranchNode) {
|
||||||
|
const result = this._delete(child, parts, index + 1);
|
||||||
|
|
||||||
|
if (typeof result !== 'undefined' && child.size === 0) {
|
||||||
|
node.delete(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
throw new Error('Inconsistent tree: Expected a branch, found a leaf instead.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//at end
|
||||||
|
if (child instanceof BranchNode) {
|
||||||
|
// TODO: maybe we can allow this
|
||||||
|
throw new Error('Inconsistent tree: Expected a leaf, found a branch instead.');
|
||||||
|
}
|
||||||
|
|
||||||
|
node.delete(name);
|
||||||
|
return child.element;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@ export class Sequence<T> implements ISequence<T>, ISpliceable<T> {
|
|||||||
|
|
||||||
readonly elements: T[] = [];
|
readonly elements: T[] = [];
|
||||||
|
|
||||||
private _onDidSplice = new Emitter<ISplice<T>>();
|
private readonly _onDidSplice = new Emitter<ISplice<T>>();
|
||||||
readonly onDidSplice: Event<ISplice<T>> = this._onDidSplice.event;
|
readonly onDidSplice: Event<ISplice<T>> = this._onDidSplice.event;
|
||||||
|
|
||||||
splice(start: number, deleteCount: number, toInsert: T[] = []): void {
|
splice(start: number, deleteCount: number, toInsert: T[] = []): void {
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { Menu, MenuItem, BrowserWindow, ipcMain } from 'electron';
|
import { Menu, MenuItem, BrowserWindow, ipcMain, IpcMainEvent } from 'electron';
|
||||||
import { ISerializableContextMenuItem, CONTEXT_MENU_CLOSE_CHANNEL, CONTEXT_MENU_CHANNEL, IPopupOptions } from 'vs/base/parts/contextmenu/common/contextmenu';
|
import { ISerializableContextMenuItem, CONTEXT_MENU_CLOSE_CHANNEL, CONTEXT_MENU_CHANNEL, IPopupOptions } from 'vs/base/parts/contextmenu/common/contextmenu';
|
||||||
|
|
||||||
export function registerContextMenuListener(): void {
|
export function registerContextMenuListener(): void {
|
||||||
ipcMain.on(CONTEXT_MENU_CHANNEL, (event: Electron.IpcMainEvent, contextMenuId: number, items: ISerializableContextMenuItem[], onClickChannel: string, options?: IPopupOptions) => {
|
ipcMain.on(CONTEXT_MENU_CHANNEL, (event: IpcMainEvent, contextMenuId: number, items: ISerializableContextMenuItem[], onClickChannel: string, options?: IPopupOptions) => {
|
||||||
const menu = createMenu(event, onClickChannel, items);
|
const menu = createMenu(event, onClickChannel, items);
|
||||||
|
|
||||||
menu.popup({
|
menu.popup({
|
||||||
@@ -27,7 +27,7 @@ export function registerContextMenuListener(): void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createMenu(event: Electron.IpcMainEvent, onClickChannel: string, items: ISerializableContextMenuItem[]): Menu {
|
function createMenu(event: IpcMainEvent, onClickChannel: string, items: ISerializableContextMenuItem[]): Menu {
|
||||||
const menu = new Menu();
|
const menu = new Menu();
|
||||||
|
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
|
|||||||
@@ -150,6 +150,10 @@ export const enum ProtocolConstants {
|
|||||||
* If there is no reconnection within this time-frame, consider the connection permanently closed...
|
* If there is no reconnection within this time-frame, consider the connection permanently closed...
|
||||||
*/
|
*/
|
||||||
ReconnectionGraceTime = 3 * 60 * 60 * 1000, // 3hrs
|
ReconnectionGraceTime = 3 * 60 * 60 * 1000, // 3hrs
|
||||||
|
/**
|
||||||
|
* Maximal grace time between the first and the last reconnection...
|
||||||
|
*/
|
||||||
|
ReconnectionShortGraceTime = 5 * 60 * 1000, // 5min
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProtocolMessage {
|
class ProtocolMessage {
|
||||||
@@ -347,10 +351,10 @@ export class Protocol extends Disposable implements IMessagePassingProtocol {
|
|||||||
private _socketWriter: ProtocolWriter;
|
private _socketWriter: ProtocolWriter;
|
||||||
private _socketReader: ProtocolReader;
|
private _socketReader: ProtocolReader;
|
||||||
|
|
||||||
private _onMessage = new Emitter<VSBuffer>();
|
private readonly _onMessage = new Emitter<VSBuffer>();
|
||||||
readonly onMessage: Event<VSBuffer> = this._onMessage.event;
|
readonly onMessage: Event<VSBuffer> = this._onMessage.event;
|
||||||
|
|
||||||
private _onClose = new Emitter<void>();
|
private readonly _onClose = new Emitter<void>();
|
||||||
readonly onClose: Event<void> = this._onClose.event;
|
readonly onClose: Event<void> = this._onClose.event;
|
||||||
|
|
||||||
constructor(socket: ISocket) {
|
constructor(socket: ISocket) {
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ export class ChannelClient implements IChannelClient, IDisposable {
|
|||||||
private lastRequestId: number = 0;
|
private lastRequestId: number = 0;
|
||||||
private protocolListener: IDisposable | null;
|
private protocolListener: IDisposable | null;
|
||||||
|
|
||||||
private _onDidInitialize = new Emitter<void>();
|
private readonly _onDidInitialize = new Emitter<void>();
|
||||||
readonly onDidInitialize = this._onDidInitialize.event;
|
readonly onDidInitialize = this._onDidInitialize.event;
|
||||||
|
|
||||||
constructor(private protocol: IMessagePassingProtocol) {
|
constructor(private protocol: IMessagePassingProtocol) {
|
||||||
@@ -660,7 +660,7 @@ export class IPCServer<TContext = string> implements IChannelServer<TContext>, I
|
|||||||
private channels = new Map<string, IServerChannel<TContext>>();
|
private channels = new Map<string, IServerChannel<TContext>>();
|
||||||
private _connections = new Set<Connection<TContext>>();
|
private _connections = new Set<Connection<TContext>>();
|
||||||
|
|
||||||
private _onDidChangeConnections = new Emitter<Connection<TContext>>();
|
private readonly _onDidChangeConnections = new Emitter<Connection<TContext>>();
|
||||||
readonly onDidChangeConnections: Event<Connection<TContext>> = this._onDidChangeConnections.event;
|
readonly onDidChangeConnections: Event<Connection<TContext>> = this._onDidChangeConnections.event;
|
||||||
|
|
||||||
get connections(): Connection<TContext>[] {
|
get connections(): Connection<TContext>[] {
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
import { Event, Emitter } from 'vs/base/common/event';
|
import { Event, Emitter } from 'vs/base/common/event';
|
||||||
import { IPCServer, ClientConnectionEvent } from 'vs/base/parts/ipc/common/ipc';
|
import { IPCServer, ClientConnectionEvent } from 'vs/base/parts/ipc/common/ipc';
|
||||||
import { Protocol } from 'vs/base/parts/ipc/node/ipc.electron';
|
import { Protocol } from 'vs/base/parts/ipc/node/ipc.electron';
|
||||||
import { ipcMain } from 'electron';
|
import { ipcMain, WebContents } from 'electron';
|
||||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||||
import { VSBuffer } from 'vs/base/common/buffer';
|
import { VSBuffer } from 'vs/base/common/buffer';
|
||||||
|
|
||||||
interface IIPCEvent {
|
interface IIPCEvent {
|
||||||
event: { sender: Electron.WebContents; };
|
event: { sender: WebContents; };
|
||||||
message: Buffer | null;
|
message: Buffer | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ export class Server extends IPCServer {
|
|||||||
private static Clients = new Map<number, IDisposable>();
|
private static Clients = new Map<number, IDisposable>();
|
||||||
|
|
||||||
private static getOnDidClientConnect(): Event<ClientConnectionEvent> {
|
private static getOnDidClientConnect(): Event<ClientConnectionEvent> {
|
||||||
const onHello = Event.fromNodeEventEmitter<Electron.WebContents>(ipcMain, 'ipc:hello', ({ sender }) => sender);
|
const onHello = Event.fromNodeEventEmitter<WebContents>(ipcMain, 'ipc:hello', ({ sender }) => sender);
|
||||||
|
|
||||||
return Event.map(onHello, webContents => {
|
return Event.map(onHello, webContents => {
|
||||||
const id = webContents.id;
|
const id = webContents.id;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export class Client implements IChannelClient, IDisposable {
|
|||||||
private _client: IPCClient | null;
|
private _client: IPCClient | null;
|
||||||
private channels = new Map<string, IChannel>();
|
private channels = new Map<string, IChannel>();
|
||||||
|
|
||||||
private _onDidProcessExit = new Emitter<{ code: number, signal: string }>();
|
private readonly _onDidProcessExit = new Emitter<{ code: number, signal: string }>();
|
||||||
readonly onDidProcessExit = this._onDidProcessExit.event;
|
readonly onDidProcessExit = this._onDidProcessExit.event;
|
||||||
|
|
||||||
constructor(private modulePath: string, private options: IIPCOptions) {
|
constructor(private modulePath: string, private options: IIPCOptions) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class QueueProtocol implements IMessagePassingProtocol {
|
|||||||
private buffering = true;
|
private buffering = true;
|
||||||
private buffers: VSBuffer[] = [];
|
private buffers: VSBuffer[] = [];
|
||||||
|
|
||||||
private _onMessage = new Emitter<VSBuffer>({
|
private readonly _onMessage = new Emitter<VSBuffer>({
|
||||||
onFirstListenerDidAdd: () => {
|
onFirstListenerDidAdd: () => {
|
||||||
for (const buffer of this.buffers) {
|
for (const buffer of this.buffers) {
|
||||||
this._onMessage.fire(buffer);
|
this._onMessage.fire(buffer);
|
||||||
@@ -57,7 +57,7 @@ function createProtocolPair(): [IMessagePassingProtocol, IMessagePassingProtocol
|
|||||||
|
|
||||||
class TestIPCClient extends IPCClient<string> {
|
class TestIPCClient extends IPCClient<string> {
|
||||||
|
|
||||||
private _onDidDisconnect = new Emitter<void>();
|
private readonly _onDidDisconnect = new Emitter<void>();
|
||||||
readonly onDidDisconnect = this._onDidDisconnect.event;
|
readonly onDidDisconnect = this._onDidDisconnect.event;
|
||||||
|
|
||||||
constructor(protocol: IMessagePassingProtocol, id: string) {
|
constructor(protocol: IMessagePassingProtocol, id: string) {
|
||||||
@@ -107,7 +107,7 @@ interface ITestService {
|
|||||||
|
|
||||||
class TestService implements ITestService {
|
class TestService implements ITestService {
|
||||||
|
|
||||||
private _pong = new Emitter<string>();
|
private readonly _pong = new Emitter<string>();
|
||||||
readonly pong = this._pong.event;
|
readonly pong = this._pong.event;
|
||||||
|
|
||||||
marco(): Promise<string> {
|
marco(): Promise<string> {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export interface ITestService {
|
|||||||
|
|
||||||
export class TestService implements ITestService {
|
export class TestService implements ITestService {
|
||||||
|
|
||||||
private _onMarco = new Emitter<IMarcoPoloEvent>();
|
private readonly _onMarco = new Emitter<IMarcoPoloEvent>();
|
||||||
onMarco: Event<IMarcoPoloEvent> = this._onMarco.event;
|
onMarco: Event<IMarcoPoloEvent> = this._onMarco.event;
|
||||||
|
|
||||||
marco(): Promise<string> {
|
marco(): Promise<string> {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ suite('Storage Library', () => {
|
|||||||
await mkdirp(storageDir);
|
await mkdirp(storageDir);
|
||||||
|
|
||||||
class TestSQLiteStorageDatabase extends SQLiteStorageDatabase {
|
class TestSQLiteStorageDatabase extends SQLiteStorageDatabase {
|
||||||
private _onDidChangeItemsExternal = new Emitter<IStorageItemsChangeEvent>();
|
private readonly _onDidChangeItemsExternal = new Emitter<IStorageItemsChangeEvent>();
|
||||||
get onDidChangeItemsExternal(): Event<IStorageItemsChangeEvent> { return this._onDidChangeItemsExternal.event; }
|
get onDidChangeItemsExternal(): Event<IStorageItemsChangeEvent> { return this._onDidChangeItemsExternal.event; }
|
||||||
|
|
||||||
fireDidChangeItemsExternal(event: IStorageItemsChangeEvent): void {
|
fireDidChangeItemsExternal(event: IStorageItemsChangeEvent): void {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export class Tree implements _.ITree {
|
|||||||
readonly onDidExpandItem: Event<Model.IItemExpandEvent> = this._onDidExpandItem.event;
|
readonly onDidExpandItem: Event<Model.IItemExpandEvent> = this._onDidExpandItem.event;
|
||||||
private _onDidCollapseItem = new Relay<Model.IItemCollapseEvent>();
|
private _onDidCollapseItem = new Relay<Model.IItemCollapseEvent>();
|
||||||
readonly onDidCollapseItem: Event<Model.IItemCollapseEvent> = this._onDidCollapseItem.event;
|
readonly onDidCollapseItem: Event<Model.IItemCollapseEvent> = this._onDidCollapseItem.event;
|
||||||
private _onDispose = new Emitter<void>();
|
private readonly _onDispose = new Emitter<void>();
|
||||||
readonly onDidDispose: Event<void> = this._onDispose.event;
|
readonly onDidDispose: Event<void> = this._onDispose.event;
|
||||||
|
|
||||||
constructor(container: HTMLElement, configuration: _.ITreeConfiguration, options: _.ITreeOptions = {}) {
|
constructor(container: HTMLElement, configuration: _.ITreeConfiguration, options: _.ITreeOptions = {}) {
|
||||||
|
|||||||
@@ -259,29 +259,29 @@ export class Item {
|
|||||||
|
|
||||||
private traits: { [trait: string]: boolean; };
|
private traits: { [trait: string]: boolean; };
|
||||||
|
|
||||||
private _onDidCreate = new Emitter<Item>();
|
private readonly _onDidCreate = new Emitter<Item>();
|
||||||
readonly onDidCreate: Event<Item> = this._onDidCreate.event;
|
readonly onDidCreate: Event<Item> = this._onDidCreate.event;
|
||||||
private _onDidReveal = new Emitter<IItemRevealEvent>();
|
private readonly _onDidReveal = new Emitter<IItemRevealEvent>();
|
||||||
readonly onDidReveal: Event<IItemRevealEvent> = this._onDidReveal.event;
|
readonly onDidReveal: Event<IItemRevealEvent> = this._onDidReveal.event;
|
||||||
private _onExpand = new Emitter<IItemExpandEvent>();
|
private readonly _onExpand = new Emitter<IItemExpandEvent>();
|
||||||
readonly onExpand: Event<IItemExpandEvent> = this._onExpand.event;
|
readonly onExpand: Event<IItemExpandEvent> = this._onExpand.event;
|
||||||
private _onDidExpand = new Emitter<IItemExpandEvent>();
|
private readonly _onDidExpand = new Emitter<IItemExpandEvent>();
|
||||||
readonly onDidExpand: Event<IItemExpandEvent> = this._onDidExpand.event;
|
readonly onDidExpand: Event<IItemExpandEvent> = this._onDidExpand.event;
|
||||||
private _onCollapse = new Emitter<IItemCollapseEvent>();
|
private readonly _onCollapse = new Emitter<IItemCollapseEvent>();
|
||||||
readonly onCollapse: Event<IItemCollapseEvent> = this._onCollapse.event;
|
readonly onCollapse: Event<IItemCollapseEvent> = this._onCollapse.event;
|
||||||
private _onDidCollapse = new Emitter<IItemCollapseEvent>();
|
private readonly _onDidCollapse = new Emitter<IItemCollapseEvent>();
|
||||||
readonly onDidCollapse: Event<IItemCollapseEvent> = this._onDidCollapse.event;
|
readonly onDidCollapse: Event<IItemCollapseEvent> = this._onDidCollapse.event;
|
||||||
private _onDidAddTrait = new Emitter<IItemTraitEvent>();
|
private readonly _onDidAddTrait = new Emitter<IItemTraitEvent>();
|
||||||
readonly onDidAddTrait: Event<IItemTraitEvent> = this._onDidAddTrait.event;
|
readonly onDidAddTrait: Event<IItemTraitEvent> = this._onDidAddTrait.event;
|
||||||
private _onDidRemoveTrait = new Emitter<IItemCollapseEvent>();
|
private readonly _onDidRemoveTrait = new Emitter<IItemCollapseEvent>();
|
||||||
readonly onDidRemoveTrait: Event<IItemCollapseEvent> = this._onDidRemoveTrait.event;
|
readonly onDidRemoveTrait: Event<IItemCollapseEvent> = this._onDidRemoveTrait.event;
|
||||||
private _onDidRefresh = new Emitter<Item>();
|
private readonly _onDidRefresh = new Emitter<Item>();
|
||||||
readonly onDidRefresh: Event<Item> = this._onDidRefresh.event;
|
readonly onDidRefresh: Event<Item> = this._onDidRefresh.event;
|
||||||
private _onRefreshChildren = new Emitter<IItemChildrenRefreshEvent>();
|
private readonly _onRefreshChildren = new Emitter<IItemChildrenRefreshEvent>();
|
||||||
readonly onRefreshChildren: Event<IItemChildrenRefreshEvent> = this._onRefreshChildren.event;
|
readonly onRefreshChildren: Event<IItemChildrenRefreshEvent> = this._onRefreshChildren.event;
|
||||||
private _onDidRefreshChildren = new Emitter<IItemChildrenRefreshEvent>();
|
private readonly _onDidRefreshChildren = new Emitter<IItemChildrenRefreshEvent>();
|
||||||
readonly onDidRefreshChildren: Event<IItemChildrenRefreshEvent> = this._onDidRefreshChildren.event;
|
readonly onDidRefreshChildren: Event<IItemChildrenRefreshEvent> = this._onDidRefreshChildren.event;
|
||||||
private _onDidDispose = new Emitter<Item>();
|
private readonly _onDidDispose = new Emitter<Item>();
|
||||||
readonly onDidDispose: Event<Item> = this._onDidDispose.event;
|
readonly onDidDispose: Event<Item> = this._onDidDispose.event;
|
||||||
|
|
||||||
private _isDisposed: boolean;
|
private _isDisposed: boolean;
|
||||||
@@ -868,19 +868,19 @@ export class TreeModel {
|
|||||||
private registryDisposable: IDisposable = Disposable.None;
|
private registryDisposable: IDisposable = Disposable.None;
|
||||||
private traitsToItems: ITraitMap;
|
private traitsToItems: ITraitMap;
|
||||||
|
|
||||||
private _onSetInput = new Emitter<IInputEvent>();
|
private readonly _onSetInput = new Emitter<IInputEvent>();
|
||||||
readonly onSetInput: Event<IInputEvent> = this._onSetInput.event;
|
readonly onSetInput: Event<IInputEvent> = this._onSetInput.event;
|
||||||
private _onDidSetInput = new Emitter<IInputEvent>();
|
private readonly _onDidSetInput = new Emitter<IInputEvent>();
|
||||||
readonly onDidSetInput: Event<IInputEvent> = this._onDidSetInput.event;
|
readonly onDidSetInput: Event<IInputEvent> = this._onDidSetInput.event;
|
||||||
private _onRefresh = new Emitter<IRefreshEvent>();
|
private readonly _onRefresh = new Emitter<IRefreshEvent>();
|
||||||
readonly onRefresh: Event<IRefreshEvent> = this._onRefresh.event;
|
readonly onRefresh: Event<IRefreshEvent> = this._onRefresh.event;
|
||||||
private _onDidRefresh = new Emitter<IRefreshEvent>();
|
private readonly _onDidRefresh = new Emitter<IRefreshEvent>();
|
||||||
readonly onDidRefresh: Event<IRefreshEvent> = this._onDidRefresh.event;
|
readonly onDidRefresh: Event<IRefreshEvent> = this._onDidRefresh.event;
|
||||||
private _onDidHighlight = new Emitter<_.IHighlightEvent>();
|
private readonly _onDidHighlight = new Emitter<_.IHighlightEvent>();
|
||||||
readonly onDidHighlight: Event<_.IHighlightEvent> = this._onDidHighlight.event;
|
readonly onDidHighlight: Event<_.IHighlightEvent> = this._onDidHighlight.event;
|
||||||
private _onDidSelect = new Emitter<_.ISelectionEvent>();
|
private readonly _onDidSelect = new Emitter<_.ISelectionEvent>();
|
||||||
readonly onDidSelect: Event<_.ISelectionEvent> = this._onDidSelect.event;
|
readonly onDidSelect: Event<_.ISelectionEvent> = this._onDidSelect.event;
|
||||||
private _onDidFocus = new Emitter<_.IFocusEvent>();
|
private readonly _onDidFocus = new Emitter<_.IFocusEvent>();
|
||||||
readonly onDidFocus: Event<_.IFocusEvent> = this._onDidFocus.event;
|
readonly onDidFocus: Event<_.IFocusEvent> = this._onDidFocus.event;
|
||||||
|
|
||||||
private _onDidRevealItem = new Relay<IItemRevealEvent>();
|
private _onDidRevealItem = new Relay<IItemRevealEvent>();
|
||||||
|
|||||||
@@ -1081,10 +1081,10 @@ class DynamicModel implements _.IDataSource {
|
|||||||
private data: any;
|
private data: any;
|
||||||
public promiseFactory: { (): Promise<any>; } | null;
|
public promiseFactory: { (): Promise<any>; } | null;
|
||||||
|
|
||||||
private _onGetChildren = new Emitter<any>();
|
private readonly _onGetChildren = new Emitter<any>();
|
||||||
readonly onGetChildren: Event<any> = this._onGetChildren.event;
|
readonly onGetChildren: Event<any> = this._onGetChildren.event;
|
||||||
|
|
||||||
private _onDidGetChildren = new Emitter<any>();
|
private readonly _onDidGetChildren = new Emitter<any>();
|
||||||
readonly onDidGetChildren: Event<any> = this._onDidGetChildren.event;
|
readonly onDidGetChildren: Event<any> = this._onDidGetChildren.event;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { IView } from 'vs/base/browser/ui/grid/grid';
|
|||||||
|
|
||||||
export class TestView implements IView {
|
export class TestView implements IView {
|
||||||
|
|
||||||
private _onDidChange = new Emitter<{ width: number; height: number; } | undefined>();
|
private readonly _onDidChange = new Emitter<{ width: number; height: number; } | undefined>();
|
||||||
readonly onDidChange = this._onDidChange.event;
|
readonly onDidChange = this._onDidChange.event;
|
||||||
|
|
||||||
get minimumWidth(): number { return this._minimumWidth; }
|
get minimumWidth(): number { return this._minimumWidth; }
|
||||||
@@ -28,7 +28,7 @@ export class TestView implements IView {
|
|||||||
private _element: HTMLElement = document.createElement('div');
|
private _element: HTMLElement = document.createElement('div');
|
||||||
get element(): HTMLElement { this._onDidGetElement.fire(); return this._element; }
|
get element(): HTMLElement { this._onDidGetElement.fire(); return this._element; }
|
||||||
|
|
||||||
private _onDidGetElement = new Emitter<void>();
|
private readonly _onDidGetElement = new Emitter<void>();
|
||||||
readonly onDidGetElement = this._onDidGetElement.event;
|
readonly onDidGetElement = this._onDidGetElement.event;
|
||||||
|
|
||||||
private _width = 0;
|
private _width = 0;
|
||||||
@@ -39,10 +39,10 @@ export class TestView implements IView {
|
|||||||
|
|
||||||
get size(): [number, number] { return [this.width, this.height]; }
|
get size(): [number, number] { return [this.width, this.height]; }
|
||||||
|
|
||||||
private _onDidLayout = new Emitter<{ width: number; height: number; }>();
|
private readonly _onDidLayout = new Emitter<{ width: number; height: number; }>();
|
||||||
readonly onDidLayout: Event<{ width: number; height: number; }> = this._onDidLayout.event;
|
readonly onDidLayout: Event<{ width: number; height: number; }> = this._onDidLayout.event;
|
||||||
|
|
||||||
private _onDidFocus = new Emitter<void>();
|
private readonly _onDidFocus = new Emitter<void>();
|
||||||
readonly onDidFocus: Event<void> = this._onDidFocus.event;
|
readonly onDidFocus: Event<void> = this._onDidFocus.event;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { Sash, SashState } from 'vs/base/browser/ui/sash/sash';
|
|||||||
|
|
||||||
class TestView implements IView {
|
class TestView implements IView {
|
||||||
|
|
||||||
private _onDidChange = new Emitter<number | undefined>();
|
private readonly _onDidChange = new Emitter<number | undefined>();
|
||||||
readonly onDidChange = this._onDidChange.event;
|
readonly onDidChange = this._onDidChange.event;
|
||||||
|
|
||||||
get minimumSize(): number { return this._minimumSize; }
|
get minimumSize(): number { return this._minimumSize; }
|
||||||
@@ -22,17 +22,17 @@ class TestView implements IView {
|
|||||||
private _element: HTMLElement = document.createElement('div');
|
private _element: HTMLElement = document.createElement('div');
|
||||||
get element(): HTMLElement { this._onDidGetElement.fire(); return this._element; }
|
get element(): HTMLElement { this._onDidGetElement.fire(); return this._element; }
|
||||||
|
|
||||||
private _onDidGetElement = new Emitter<void>();
|
private readonly _onDidGetElement = new Emitter<void>();
|
||||||
readonly onDidGetElement = this._onDidGetElement.event;
|
readonly onDidGetElement = this._onDidGetElement.event;
|
||||||
|
|
||||||
private _size = 0;
|
private _size = 0;
|
||||||
get size(): number { return this._size; }
|
get size(): number { return this._size; }
|
||||||
private _orthogonalSize: number | undefined = 0;
|
private _orthogonalSize: number | undefined = 0;
|
||||||
get orthogonalSize(): number | undefined { return this._orthogonalSize; }
|
get orthogonalSize(): number | undefined { return this._orthogonalSize; }
|
||||||
private _onDidLayout = new Emitter<{ size: number; orthogonalSize: number | undefined }>();
|
private readonly _onDidLayout = new Emitter<{ size: number; orthogonalSize: number | undefined }>();
|
||||||
readonly onDidLayout = this._onDidLayout.event;
|
readonly onDidLayout = this._onDidLayout.event;
|
||||||
|
|
||||||
private _onDidFocus = new Emitter<void>();
|
private readonly _onDidFocus = new Emitter<void>();
|
||||||
readonly onDidFocus = this._onDidFocus.event;
|
readonly onDidFocus = this._onDidFocus.event;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
@@ -690,4 +690,38 @@ suite('IndexTreeModel', function () {
|
|||||||
assert.deepEqual(model.getNodeLocation(list[3]), [0, 5]);
|
assert.deepEqual(model.getNodeLocation(list[3]), [0, 5]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('refilter with filtered out nodes', function () {
|
||||||
|
const list: ITreeNode<string>[] = [];
|
||||||
|
let query = new RegExp('');
|
||||||
|
const filter = new class implements ITreeFilter<string> {
|
||||||
|
filter(element: string): boolean {
|
||||||
|
return query.test(element);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const model = new IndexTreeModel<string>('test', toSpliceable(list), 'root', { filter });
|
||||||
|
|
||||||
|
model.splice([0], 0, Iterator.fromArray([
|
||||||
|
{ element: 'silver' },
|
||||||
|
{ element: 'gold' },
|
||||||
|
{ element: 'platinum' }
|
||||||
|
]));
|
||||||
|
|
||||||
|
assert.deepEqual(toArray(list), ['silver', 'gold', 'platinum']);
|
||||||
|
|
||||||
|
query = /platinum/;
|
||||||
|
model.refilter();
|
||||||
|
assert.deepEqual(toArray(list), ['platinum']);
|
||||||
|
|
||||||
|
model.splice([0], Number.POSITIVE_INFINITY, Iterator.fromArray([
|
||||||
|
{ element: 'silver' },
|
||||||
|
{ element: 'gold' },
|
||||||
|
{ element: 'platinum' }
|
||||||
|
]));
|
||||||
|
assert.deepEqual(toArray(list), ['platinum']);
|
||||||
|
|
||||||
|
model.refilter();
|
||||||
|
assert.deepEqual(toArray(list), ['platinum']);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import { memoize } from 'vs/base/common/decorators';
|
import { memoize, createMemoizer } from 'vs/base/common/decorators';
|
||||||
|
|
||||||
suite('Decorators', () => {
|
suite('Decorators', () => {
|
||||||
test('memoize should memoize methods', () => {
|
test('memoize should memoize methods', () => {
|
||||||
@@ -125,4 +125,24 @@ suite('Decorators', () => {
|
|||||||
assert.equal(foo.answer, 42);
|
assert.equal(foo.answer, 42);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('memoize clear', () => {
|
||||||
|
const memoizer = createMemoizer();
|
||||||
|
let counter = 0;
|
||||||
|
class Foo {
|
||||||
|
@memoizer
|
||||||
|
get answer() { return ++counter; }
|
||||||
|
}
|
||||||
|
|
||||||
|
const foo = new Foo();
|
||||||
|
assert.equal(foo.answer, 1);
|
||||||
|
assert.equal(foo.answer, 1);
|
||||||
|
memoizer.clear();
|
||||||
|
assert.equal(foo.answer, 2);
|
||||||
|
assert.equal(foo.answer, 2);
|
||||||
|
memoizer.clear();
|
||||||
|
assert.equal(foo.answer, 3);
|
||||||
|
assert.equal(foo.answer, 3);
|
||||||
|
assert.equal(foo.answer, 3);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Samples {
|
|||||||
|
|
||||||
export class Document3 {
|
export class Document3 {
|
||||||
|
|
||||||
private _onDidChange = new Emitter<string>();
|
private readonly _onDidChange = new Emitter<string>();
|
||||||
|
|
||||||
onDidChange: Event<string> = this._onDidChange.event;
|
onDidChange: Event<string> = this._onDidChange.event;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as assert from 'assert';
|
||||||
|
import { ResourceTree, IBranchNode, ILeafNode } from 'vs/base/common/resourceTree';
|
||||||
|
import { URI } from 'vs/base/common/uri';
|
||||||
|
|
||||||
|
suite('ResourceTree', function () {
|
||||||
|
test('ctor', function () {
|
||||||
|
const tree = new ResourceTree<string, null>(null);
|
||||||
|
assert(ResourceTree.isBranchNode(tree.root));
|
||||||
|
assert.equal(tree.root.size, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('simple', function () {
|
||||||
|
const tree = new ResourceTree<string, null>(null);
|
||||||
|
|
||||||
|
tree.add(URI.file('/foo/bar.txt'), 'bar contents');
|
||||||
|
assert(ResourceTree.isBranchNode(tree.root));
|
||||||
|
assert.equal(tree.root.size, 1);
|
||||||
|
|
||||||
|
let foo = tree.root.get('foo') as IBranchNode<string, null>;
|
||||||
|
assert(foo);
|
||||||
|
assert(ResourceTree.isBranchNode(foo));
|
||||||
|
assert.equal(foo.size, 1);
|
||||||
|
|
||||||
|
let bar = foo.get('bar.txt') as ILeafNode<string, null>;
|
||||||
|
assert(bar);
|
||||||
|
assert(!ResourceTree.isBranchNode(bar));
|
||||||
|
assert.equal(bar.element, 'bar contents');
|
||||||
|
|
||||||
|
tree.add(URI.file('/hello.txt'), 'hello contents');
|
||||||
|
assert.equal(tree.root.size, 2);
|
||||||
|
|
||||||
|
let hello = tree.root.get('hello.txt') as ILeafNode<string, null>;
|
||||||
|
assert(hello);
|
||||||
|
assert(!ResourceTree.isBranchNode(hello));
|
||||||
|
assert.equal(hello.element, 'hello contents');
|
||||||
|
|
||||||
|
tree.delete(URI.file('/foo/bar.txt'));
|
||||||
|
assert.equal(tree.root.size, 1);
|
||||||
|
hello = tree.root.get('hello.txt') as ILeafNode<string, null>;
|
||||||
|
assert(hello);
|
||||||
|
assert(!ResourceTree.isBranchNode(hello));
|
||||||
|
assert.equal(hello.element, 'hello contents');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -209,4 +209,10 @@ if (options.workspaceUri) {
|
|||||||
options.workspaceUri = URI.revive(options.workspaceUri);
|
options.workspaceUri = URI.revive(options.workspaceUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(options.staticExtensions)) {
|
||||||
|
options.staticExtensions.forEach(extension => {
|
||||||
|
extension.extensionLocation = URI.revive(extension.extensionLocation);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
create(document.body, options);
|
create(document.body, options);
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ export class IssueReporter extends Disposable {
|
|||||||
const loggerClient = new LoggerChannelClient(mainProcessService.getChannel('logger'));
|
const loggerClient = new LoggerChannelClient(mainProcessService.getChannel('logger'));
|
||||||
this.logService = new FollowerLogService(loggerClient, logService);
|
this.logService = new FollowerLogService(loggerClient, logService);
|
||||||
|
|
||||||
const sharedProcess = (<IWindowsService>serviceCollection.get(IWindowsService)).whenSharedProcessReady()
|
const sharedProcess = mainProcessService.getChannel('sharedProcess').call('whenSharedProcessReady')
|
||||||
.then(() => connectNet(this.environmentService.sharedIPCHandle, `window:${configuration.windowId}`));
|
.then(() => connectNet(this.environmentService.sharedIPCHandle, `window:${configuration.windowId}`));
|
||||||
|
|
||||||
const instantiationService = new InstantiationService(serviceCollection, true);
|
const instantiationService = new InstantiationService(serviceCollection, true);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ import { IFileService } from 'vs/platform/files/common/files';
|
|||||||
import { DiskFileSystemProvider } from 'vs/platform/files/electron-browser/diskFileSystemProvider';
|
import { DiskFileSystemProvider } from 'vs/platform/files/electron-browser/diskFileSystemProvider';
|
||||||
import { Schemas } from 'vs/base/common/network';
|
import { Schemas } from 'vs/base/common/network';
|
||||||
import { IProductService } from 'vs/platform/product/common/productService';
|
import { IProductService } from 'vs/platform/product/common/productService';
|
||||||
import { IUserDataSyncService, IUserDataSyncStoreService, ISettingsMergeService } from 'vs/platform/userDataSync/common/userDataSync';
|
import { IUserDataSyncService, IUserDataSyncStoreService, ISettingsMergeService, registerConfiguration } from 'vs/platform/userDataSync/common/userDataSync';
|
||||||
import { UserDataSyncService, UserDataAutoSync } from 'vs/platform/userDataSync/common/userDataSyncService';
|
import { UserDataSyncService, UserDataAutoSync } from 'vs/platform/userDataSync/common/userDataSyncService';
|
||||||
import { UserDataSyncStoreService } from 'vs/platform/userDataSync/common/userDataSyncStoreService';
|
import { UserDataSyncStoreService } from 'vs/platform/userDataSync/common/userDataSyncStoreService';
|
||||||
import { UserDataSyncChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc';
|
import { UserDataSyncChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc';
|
||||||
@@ -122,11 +122,6 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
|
|||||||
const windowsService = new WindowsService(mainProcessService);
|
const windowsService = new WindowsService(mainProcessService);
|
||||||
services.set(IWindowsService, windowsService);
|
services.set(IWindowsService, windowsService);
|
||||||
|
|
||||||
const activeWindowManager = new ActiveWindowManager(windowsService);
|
|
||||||
const activeWindowRouter = new StaticRouter(ctx => activeWindowManager.getActiveClientId().then(id => ctx === id));
|
|
||||||
const settingsMergeChannel = server.getChannel('settingsMerge', activeWindowRouter);
|
|
||||||
services.set(ISettingsMergeService, new SettingsMergeChannelClient(settingsMergeChannel));
|
|
||||||
|
|
||||||
// Files
|
// Files
|
||||||
const fileService = new FileService(logService);
|
const fileService = new FileService(logService);
|
||||||
services.set(IFileService, fileService);
|
services.set(IFileService, fileService);
|
||||||
@@ -173,8 +168,15 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
|
|||||||
services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
|
services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
|
||||||
services.set(ILocalizationsService, new SyncDescriptor(LocalizationsService));
|
services.set(ILocalizationsService, new SyncDescriptor(LocalizationsService));
|
||||||
services.set(IDiagnosticsService, new SyncDescriptor(DiagnosticsService));
|
services.set(IDiagnosticsService, new SyncDescriptor(DiagnosticsService));
|
||||||
|
|
||||||
|
// User Data Sync Contributions
|
||||||
|
const activeWindowManager = new ActiveWindowManager(windowsService);
|
||||||
|
const activeWindowRouter = new StaticRouter(ctx => activeWindowManager.getActiveClientId().then(id => ctx === id));
|
||||||
|
const settingsMergeChannel = server.getChannel('settingsMerge', activeWindowRouter);
|
||||||
|
services.set(ISettingsMergeService, new SettingsMergeChannelClient(settingsMergeChannel));
|
||||||
services.set(IUserDataSyncStoreService, new SyncDescriptor(UserDataSyncStoreService));
|
services.set(IUserDataSyncStoreService, new SyncDescriptor(UserDataSyncStoreService));
|
||||||
services.set(IUserDataSyncService, new SyncDescriptor(UserDataSyncService));
|
services.set(IUserDataSyncService, new SyncDescriptor(UserDataSyncService));
|
||||||
|
registerConfiguration();
|
||||||
|
|
||||||
const instantiationService2 = instantiationService.createChild(services);
|
const instantiationService2 = instantiationService.createChild(services);
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { app, ipcMain as ipc, systemPreferences, shell, Event, contentTracing, protocol, powerMonitor } from 'electron';
|
import { app, ipcMain as ipc, systemPreferences, shell, Event, contentTracing, protocol, powerMonitor, IpcMainEvent } from 'electron';
|
||||||
import { IProcessEnvironment, isWindows, isMacintosh } from 'vs/base/common/platform';
|
import { IProcessEnvironment, isWindows, isMacintosh } from 'vs/base/common/platform';
|
||||||
import { WindowsManager } from 'vs/code/electron-main/windows';
|
import { WindowsManager } from 'vs/code/electron-main/windows';
|
||||||
import { IWindowsService, OpenContext, ActiveWindowManager, IURIToOpen } from 'vs/platform/windows/common/windows';
|
import { IWindowsService, OpenContext, ActiveWindowManager, IURIToOpen } from 'vs/platform/windows/common/windows';
|
||||||
import { WindowsChannel } from 'vs/platform/windows/common/windowsIpc';
|
import { WindowsChannel } from 'vs/platform/windows/common/windowsIpc';
|
||||||
import { WindowsService } from 'vs/platform/windows/electron-main/windowsService';
|
import { LegacyWindowsMainService } from 'vs/platform/windows/electron-main/legacyWindowsMainService';
|
||||||
import { ILifecycleMainService, LifecycleMainPhase } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
import { ILifecycleMainService, LifecycleMainPhase } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||||
import { getShellEnvironment } from 'vs/code/node/shellEnv';
|
import { getShellEnvironment } from 'vs/code/node/shellEnv';
|
||||||
import { IUpdateService } from 'vs/platform/update/common/update';
|
import { IUpdateService } from 'vs/platform/update/common/update';
|
||||||
@@ -17,7 +17,7 @@ import { Server as ElectronIPCServer } from 'vs/base/parts/ipc/electron-main/ipc
|
|||||||
import { Client } from 'vs/base/parts/ipc/common/ipc.net';
|
import { Client } from 'vs/base/parts/ipc/common/ipc.net';
|
||||||
import { Server, connect } from 'vs/base/parts/ipc/node/ipc.net';
|
import { Server, connect } from 'vs/base/parts/ipc/node/ipc.net';
|
||||||
import { SharedProcess } from 'vs/code/electron-main/sharedProcess';
|
import { SharedProcess } from 'vs/code/electron-main/sharedProcess';
|
||||||
import { LaunchMainService, LaunchChannel, ILaunchMainService } from 'vs/platform/launch/electron-main/launchService';
|
import { LaunchMainService, LaunchChannel, ILaunchMainService } from 'vs/platform/launch/electron-main/launchMainService';
|
||||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||||
@@ -53,7 +53,6 @@ import { ElectronURLListener } from 'vs/platform/url/electron-main/electronUrlLi
|
|||||||
import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver';
|
import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver';
|
||||||
import { IMenubarService } from 'vs/platform/menubar/node/menubar';
|
import { IMenubarService } from 'vs/platform/menubar/node/menubar';
|
||||||
import { MenubarMainService } from 'vs/platform/menubar/electron-main/menubarMainService';
|
import { MenubarMainService } from 'vs/platform/menubar/electron-main/menubarMainService';
|
||||||
import { MenubarChannel } from 'vs/platform/menubar/node/menubarIpc';
|
|
||||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||||
import { registerContextMenuListener } from 'vs/base/parts/contextmenu/electron-main/contextmenu';
|
import { registerContextMenuListener } from 'vs/base/parts/contextmenu/electron-main/contextmenu';
|
||||||
import { homedir } from 'os';
|
import { homedir } from 'os';
|
||||||
@@ -78,6 +77,7 @@ import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemPro
|
|||||||
import { ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc';
|
import { ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc';
|
||||||
import { IElectronService } from 'vs/platform/electron/node/electron';
|
import { IElectronService } from 'vs/platform/electron/node/electron';
|
||||||
import { ElectronMainService } from 'vs/platform/electron/electron-main/electronMainService';
|
import { ElectronMainService } from 'vs/platform/electron/electron-main/electronMainService';
|
||||||
|
import { ISharedProcessMainService, SharedProcessMainService } from 'vs/platform/ipc/electron-main/sharedProcessMainService';
|
||||||
|
|
||||||
export class CodeApplication extends Disposable {
|
export class CodeApplication extends Disposable {
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ export class CodeApplication extends Disposable {
|
|||||||
|
|
||||||
// Mac only event: open new window when we get activated
|
// Mac only event: open new window when we get activated
|
||||||
if (!hasVisibleWindows && this.windowsMainService) {
|
if (!hasVisibleWindows && this.windowsMainService) {
|
||||||
this.windowsMainService.openNewWindow(OpenContext.DOCK);
|
this.windowsMainService.openEmptyWindow(OpenContext.DOCK);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -165,8 +165,8 @@ export class CodeApplication extends Disposable {
|
|||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
app.on('web-contents-created', (_event: Electron.Event, contents) => {
|
app.on('web-contents-created', (_event: Event, contents) => {
|
||||||
contents.on('will-attach-webview', (event: Electron.Event, webPreferences, params) => {
|
contents.on('will-attach-webview', (event: Event, webPreferences, params) => {
|
||||||
|
|
||||||
const isValidWebviewSource = (source: string): boolean => {
|
const isValidWebviewSource = (source: string): boolean => {
|
||||||
if (!source) {
|
if (!source) {
|
||||||
@@ -247,7 +247,7 @@ export class CodeApplication extends Disposable {
|
|||||||
|
|
||||||
app.on('new-window-for-tab', () => {
|
app.on('new-window-for-tab', () => {
|
||||||
if (this.windowsMainService) {
|
if (this.windowsMainService) {
|
||||||
this.windowsMainService.openNewWindow(OpenContext.DESKTOP); //macOS native tab "+" button
|
this.windowsMainService.openEmptyWindow(OpenContext.DESKTOP); //macOS native tab "+" button
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ export class CodeApplication extends Disposable {
|
|||||||
this.lifecycleMainService.kill(code);
|
this.lifecycleMainService.kill(code);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('vscode:fetchShellEnv', async (event: Electron.IpcMainEvent) => {
|
ipc.on('vscode:fetchShellEnv', async (event: IpcMainEvent) => {
|
||||||
const webContents = event.sender;
|
const webContents = event.sender;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -275,10 +275,10 @@ export class CodeApplication extends Disposable {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('vscode:toggleDevTools', (event: Electron.IpcMainEvent) => event.sender.toggleDevTools());
|
ipc.on('vscode:toggleDevTools', (event: IpcMainEvent) => event.sender.toggleDevTools());
|
||||||
ipc.on('vscode:openDevTools', (event: Electron.IpcMainEvent) => event.sender.openDevTools());
|
ipc.on('vscode:openDevTools', (event: IpcMainEvent) => event.sender.openDevTools());
|
||||||
|
|
||||||
ipc.on('vscode:reloadWindow', (event: Electron.IpcMainEvent) => event.sender.reload());
|
ipc.on('vscode:reloadWindow', (event: IpcMainEvent) => event.sender.reload());
|
||||||
|
|
||||||
// Some listeners after window opened
|
// Some listeners after window opened
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -449,7 +449,8 @@ export class CodeApplication extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
services.set(IWindowsMainService, new SyncDescriptor(WindowsManager, [machineId, this.userEnv]));
|
services.set(IWindowsMainService, new SyncDescriptor(WindowsManager, [machineId, this.userEnv]));
|
||||||
services.set(IWindowsService, new SyncDescriptor(WindowsService, [sharedProcess]));
|
services.set(ISharedProcessMainService, new SyncDescriptor(SharedProcessMainService, [sharedProcess]));
|
||||||
|
services.set(IWindowsService, new SyncDescriptor(LegacyWindowsMainService));
|
||||||
services.set(ILaunchMainService, new SyncDescriptor(LaunchMainService));
|
services.set(ILaunchMainService, new SyncDescriptor(LaunchMainService));
|
||||||
|
|
||||||
const diagnosticsChannel = getDelayedChannel(sharedProcessClient.then(client => client.getChannel('diagnostics')));
|
const diagnosticsChannel = getDelayedChannel(sharedProcessClient.then(client => client.getChannel('diagnostics')));
|
||||||
@@ -546,8 +547,12 @@ export class CodeApplication extends Disposable {
|
|||||||
const electronChannel = new SimpleServiceProxyChannel(electronService);
|
const electronChannel = new SimpleServiceProxyChannel(electronService);
|
||||||
electronIpcServer.registerChannel('electron', electronChannel);
|
electronIpcServer.registerChannel('electron', electronChannel);
|
||||||
|
|
||||||
|
const sharedProcessMainService = accessor.get(ISharedProcessMainService);
|
||||||
|
const sharedProcessChannel = new SimpleServiceProxyChannel(sharedProcessMainService);
|
||||||
|
electronIpcServer.registerChannel('sharedProcess', sharedProcessChannel);
|
||||||
|
|
||||||
const workspacesMainService = accessor.get(IWorkspacesMainService);
|
const workspacesMainService = accessor.get(IWorkspacesMainService);
|
||||||
const workspacesChannel = new WorkspacesChannel(workspacesMainService);
|
const workspacesChannel = new WorkspacesChannel(workspacesMainService, accessor.get(IWindowsMainService));
|
||||||
electronIpcServer.registerChannel('workspaces', workspacesChannel);
|
electronIpcServer.registerChannel('workspaces', workspacesChannel);
|
||||||
|
|
||||||
const windowsService = accessor.get(IWindowsService);
|
const windowsService = accessor.get(IWindowsService);
|
||||||
@@ -556,7 +561,7 @@ export class CodeApplication extends Disposable {
|
|||||||
sharedProcessClient.then(client => client.registerChannel('windows', windowsChannel));
|
sharedProcessClient.then(client => client.registerChannel('windows', windowsChannel));
|
||||||
|
|
||||||
const menubarService = accessor.get(IMenubarService);
|
const menubarService = accessor.get(IMenubarService);
|
||||||
const menubarChannel = new MenubarChannel(menubarService);
|
const menubarChannel = new SimpleServiceProxyChannel(menubarService);
|
||||||
electronIpcServer.registerChannel('menubar', menubarChannel);
|
electronIpcServer.registerChannel('menubar', menubarChannel);
|
||||||
|
|
||||||
const urlService = accessor.get(IURLService);
|
const urlService = accessor.get(IURLService);
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ import { localize } from 'vs/nls';
|
|||||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||||
import { IWindowsMainService } from 'vs/platform/windows/electron-main/windows';
|
import { IWindowsMainService } from 'vs/platform/windows/electron-main/windows';
|
||||||
import { Event } from 'vs/base/common/event';
|
import { Event } from 'vs/base/common/event';
|
||||||
import { BrowserWindow, app } from 'electron';
|
import { BrowserWindow, app, AuthInfo, WebContents, Event as ElectronEvent } from 'electron';
|
||||||
|
|
||||||
type LoginEvent = {
|
type LoginEvent = {
|
||||||
event: Electron.Event;
|
event: ElectronEvent;
|
||||||
webContents: Electron.WebContents;
|
webContents: WebContents;
|
||||||
req: Electron.Request;
|
req: Request;
|
||||||
authInfo: Electron.AuthInfo;
|
authInfo: AuthInfo;
|
||||||
cb: (username: string, password: string) => void;
|
cb: (username: string, password: string) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { mkdirp } from 'vs/base/node/pfs';
|
|||||||
import { validatePaths } from 'vs/code/node/paths';
|
import { validatePaths } from 'vs/code/node/paths';
|
||||||
import { LifecycleMainService, ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
import { LifecycleMainService, ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||||
import { Server, serve, connect } from 'vs/base/parts/ipc/node/ipc.net';
|
import { Server, serve, connect } from 'vs/base/parts/ipc/node/ipc.net';
|
||||||
import { LaunchChannelClient } from 'vs/platform/launch/electron-main/launchService';
|
import { LaunchChannelClient } from 'vs/platform/launch/electron-main/launchMainService';
|
||||||
import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export class SharedProcess implements ISharedProcess {
|
|||||||
|
|
||||||
private barrier = new Barrier();
|
private barrier = new Barrier();
|
||||||
|
|
||||||
private window: Electron.BrowserWindow | null = null;
|
private window: BrowserWindow | null = null;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly machineId: string,
|
private readonly machineId: string,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import * as path from 'vs/base/common/path';
|
|||||||
import * as objects from 'vs/base/common/objects';
|
import * as objects from 'vs/base/common/objects';
|
||||||
import * as nls from 'vs/nls';
|
import * as nls from 'vs/nls';
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage, Rectangle, Display } from 'electron';
|
import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage, Rectangle, Display, TouchBarSegmentedControl, NativeImage, BrowserWindowConstructorOptions, SegmentedControlSegment } from 'electron';
|
||||||
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
|
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||||
import { ILogService } from 'vs/platform/log/common/log';
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
@@ -44,7 +44,7 @@ export const defaultWindowState = function (mode = WindowMode.Normal): IWindowSt
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
interface ITouchBarSegment extends Electron.SegmentedControlSegment {
|
interface ITouchBarSegment extends SegmentedControlSegment {
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||||||
private hiddenTitleBarStyle: boolean;
|
private hiddenTitleBarStyle: boolean;
|
||||||
private showTimeoutHandle: NodeJS.Timeout;
|
private showTimeoutHandle: NodeJS.Timeout;
|
||||||
private _id: number;
|
private _id: number;
|
||||||
private _win: Electron.BrowserWindow;
|
private _win: BrowserWindow;
|
||||||
private _lastFocusTime: number;
|
private _lastFocusTime: number;
|
||||||
private _readyState: ReadyState;
|
private _readyState: ReadyState;
|
||||||
private windowState: IWindowState;
|
private windowState: IWindowState;
|
||||||
@@ -72,7 +72,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||||||
|
|
||||||
private marketplaceHeadersPromise: Promise<object>;
|
private marketplaceHeadersPromise: Promise<object>;
|
||||||
|
|
||||||
private readonly touchBarGroups: Electron.TouchBarSegmentedControl[];
|
private readonly touchBarGroups: TouchBarSegmentedControl[];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
config: IWindowCreationOptions,
|
config: IWindowCreationOptions,
|
||||||
@@ -116,7 +116,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||||||
// in case we are maximized or fullscreen, only show later after the call to maximize/fullscreen (see below)
|
// in case we are maximized or fullscreen, only show later after the call to maximize/fullscreen (see below)
|
||||||
const isFullscreenOrMaximized = (this.windowState.mode === WindowMode.Maximized || this.windowState.mode === WindowMode.Fullscreen);
|
const isFullscreenOrMaximized = (this.windowState.mode === WindowMode.Maximized || this.windowState.mode === WindowMode.Fullscreen);
|
||||||
|
|
||||||
const options: Electron.BrowserWindowConstructorOptions = {
|
const options: BrowserWindowConstructorOptions = {
|
||||||
width: this.windowState.width,
|
width: this.windowState.width,
|
||||||
height: this.windowState.height,
|
height: this.windowState.height,
|
||||||
x: this.windowState.x,
|
x: this.windowState.x,
|
||||||
@@ -231,7 +231,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||||||
return this._id;
|
return this._id;
|
||||||
}
|
}
|
||||||
|
|
||||||
get win(): Electron.BrowserWindow {
|
get win(): BrowserWindow {
|
||||||
return this._win;
|
return this._win;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,7 +421,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Window Failed to load
|
// Window Failed to load
|
||||||
this._win.webContents.on('did-fail-load', (event: Electron.Event, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean) => {
|
this._win.webContents.on('did-fail-load', (event: Event, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean) => {
|
||||||
this.logService.warn('[electron event]: fail to load, ', errorDescription);
|
this.logService.warn('[electron event]: fail to load, ', errorDescription);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -653,7 +653,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||||||
|
|
||||||
// only consider non-minimized window states
|
// only consider non-minimized window states
|
||||||
if (mode === WindowMode.Normal || mode === WindowMode.Maximized) {
|
if (mode === WindowMode.Normal || mode === WindowMode.Maximized) {
|
||||||
let bounds: Electron.Rectangle;
|
let bounds: Rectangle;
|
||||||
if (mode === WindowMode.Normal) {
|
if (mode === WindowMode.Normal) {
|
||||||
bounds = this.getBounds();
|
bounds = this.getBounds();
|
||||||
} else {
|
} else {
|
||||||
@@ -778,7 +778,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
getBounds(): Electron.Rectangle {
|
getBounds(): Rectangle {
|
||||||
const pos = this._win.getPosition();
|
const pos = this._win.getPosition();
|
||||||
const dimension = this._win.getSize();
|
const dimension = this._win.getSize();
|
||||||
|
|
||||||
@@ -908,7 +908,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onWindowTitleDoubleClick(): void {
|
handleTitleDoubleClick(): void {
|
||||||
|
|
||||||
// Respect system settings on mac with regards to title click on windows title
|
// Respect system settings on mac with regards to title click on windows title
|
||||||
if (isMacintosh) {
|
if (isMacintosh) {
|
||||||
@@ -988,7 +988,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||||||
this._win.setTouchBar(new TouchBar({ items: this.touchBarGroups }));
|
this._win.setTouchBar(new TouchBar({ items: this.touchBarGroups }));
|
||||||
}
|
}
|
||||||
|
|
||||||
private createTouchBarGroup(items: ISerializableCommandAction[] = []): Electron.TouchBarSegmentedControl {
|
private createTouchBarGroup(items: ISerializableCommandAction[] = []): TouchBarSegmentedControl {
|
||||||
|
|
||||||
// Group Segments
|
// Group Segments
|
||||||
const segments = this.createTouchBarGroupSegments(items);
|
const segments = this.createTouchBarGroupSegments(items);
|
||||||
@@ -1008,7 +1008,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||||||
|
|
||||||
private createTouchBarGroupSegments(items: ISerializableCommandAction[] = []): ITouchBarSegment[] {
|
private createTouchBarGroupSegments(items: ISerializableCommandAction[] = []): ITouchBarSegment[] {
|
||||||
const segments: ITouchBarSegment[] = items.map(item => {
|
const segments: ITouchBarSegment[] = items.map(item => {
|
||||||
let icon: Electron.NativeImage | undefined;
|
let icon: NativeImage | undefined;
|
||||||
if (item.iconLocation && item.iconLocation.dark.scheme === 'file') {
|
if (item.iconLocation && item.iconLocation.dark.scheme === 'file') {
|
||||||
icon = nativeImage.createFromPath(URI.revive(item.iconLocation.dark).fsPath);
|
icon = nativeImage.createFromPath(URI.revive(item.iconLocation.dark).fsPath);
|
||||||
if (icon.isEmpty()) {
|
if (icon.isEmpty()) {
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ import { IEmptyWindowBackupInfo } from 'vs/platform/backup/node/backup';
|
|||||||
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
|
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||||
import { IStateService } from 'vs/platform/state/common/state';
|
import { IStateService } from 'vs/platform/state/common/state';
|
||||||
import { CodeWindow, defaultWindowState } from 'vs/code/electron-main/window';
|
import { CodeWindow, defaultWindowState } from 'vs/code/electron-main/window';
|
||||||
import { ipcMain as ipc, screen, BrowserWindow, dialog, systemPreferences, FileFilter } from 'electron';
|
import { ipcMain as ipc, screen, BrowserWindow, dialog, systemPreferences, FileFilter, shell, MessageBoxReturnValue, MessageBoxOptions, SaveDialogOptions, SaveDialogReturnValue, OpenDialogOptions, OpenDialogReturnValue, Display } from 'electron';
|
||||||
import { parseLineAndColumnAware } from 'vs/code/node/paths';
|
import { parseLineAndColumnAware } from 'vs/code/node/paths';
|
||||||
import { ILifecycleMainService, UnloadReason, LifecycleMainService, LifecycleMainPhase } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
import { ILifecycleMainService, UnloadReason, LifecycleMainService, LifecycleMainPhase } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
import { ILogService } from 'vs/platform/log/common/log';
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
import { IWindowSettings, OpenContext, IPath, IWindowConfiguration, INativeOpenDialogOptions, IPathsToWaitFor, IEnterWorkspaceResult, IMessageBoxResult, INewWindowOptions, IURIToOpen, isFileToOpen, isWorkspaceToOpen, isFolderToOpen } from 'vs/platform/windows/common/windows';
|
import { IWindowSettings, OpenContext, IPath, IWindowConfiguration, INativeOpenDialogOptions, IPathsToWaitFor, IEnterWorkspaceResult, IURIToOpen, isFileToOpen, isWorkspaceToOpen, isFolderToOpen } from 'vs/platform/windows/common/windows';
|
||||||
import { getLastActiveWindow, findBestWindowOrFolderForFile, findWindowOnWorkspace, findWindowOnExtensionDevelopmentPath, findWindowOnWorkspaceOrFolderUri } from 'vs/code/node/windowsFinder';
|
import { getLastActiveWindow, findBestWindowOrFolderForFile, findWindowOnWorkspace, findWindowOnExtensionDevelopmentPath, findWindowOnWorkspaceOrFolderUri } from 'vs/code/node/windowsFinder';
|
||||||
import { Event as CommonEvent, Emitter } from 'vs/base/common/event';
|
import { Event as CommonEvent, Emitter } from 'vs/base/common/event';
|
||||||
import product from 'vs/platform/product/common/product';
|
import product from 'vs/platform/product/common/product';
|
||||||
@@ -197,9 +197,8 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
@IInstantiationService private readonly instantiationService: IInstantiationService
|
@IInstantiationService private readonly instantiationService: IInstantiationService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
const windowsStateStoreData = this.stateService.getItem<WindowsStateStorageData>(WindowsManager.windowsStateStorageKey);
|
|
||||||
|
|
||||||
this.windowsState = restoreWindowsState(windowsStateStoreData);
|
this.windowsState = restoreWindowsState(this.stateService.getItem<WindowsStateStorageData>(WindowsManager.windowsStateStorageKey));
|
||||||
if (!Array.isArray(this.windowsState.openedWindows)) {
|
if (!Array.isArray(this.windowsState.openedWindows)) {
|
||||||
this.windowsState.openedWindows = [];
|
this.windowsState.openedWindows = [];
|
||||||
}
|
}
|
||||||
@@ -227,7 +226,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
private registerListeners(): void {
|
private registerListeners(): void {
|
||||||
|
|
||||||
// React to workbench ready events from windows
|
// React to workbench ready events from windows
|
||||||
ipc.on('vscode:workbenchReady', (event: Electron.Event, windowId: number) => {
|
ipc.on('vscode:workbenchReady', (event: Event, windowId: number) => {
|
||||||
this.logService.trace('IPC#vscode-workbenchReady');
|
this.logService.trace('IPC#vscode-workbenchReady');
|
||||||
|
|
||||||
const win = this.getWindowById(windowId);
|
const win = this.getWindowById(windowId);
|
||||||
@@ -381,6 +380,12 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async openExternal(url: string): Promise<boolean> {
|
||||||
|
shell.openExternal(url);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
open(openConfig: IOpenConfiguration): ICodeWindow[] {
|
open(openConfig: IOpenConfiguration): ICodeWindow[] {
|
||||||
this.logService.trace('windowsManager#open');
|
this.logService.trace('windowsManager#open');
|
||||||
openConfig = this.validateOpenConfig(openConfig);
|
openConfig = this.validateOpenConfig(openConfig);
|
||||||
@@ -867,7 +872,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
message = localize('uriInvalidTitle', "URI can not be opened");
|
message = localize('uriInvalidTitle', "URI can not be opened");
|
||||||
detail = localize('uriInvalidDetail', "The URI '{0}' is not valid and can not be opened.", uri.toString());
|
detail = localize('uriInvalidDetail', "The URI '{0}' is not valid and can not be opened.", uri.toString());
|
||||||
}
|
}
|
||||||
const options: Electron.MessageBoxOptions = {
|
const options: MessageBoxOptions = {
|
||||||
title: product.nameLong,
|
title: product.nameLong,
|
||||||
type: 'info',
|
type: 'info',
|
||||||
buttons: [localize('ok', "OK")],
|
buttons: [localize('ok', "OK")],
|
||||||
@@ -1468,7 +1473,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
//
|
//
|
||||||
|
|
||||||
// We want the new window to open on the same display that the last active one is in
|
// We want the new window to open on the same display that the last active one is in
|
||||||
let displayToUse: Electron.Display | undefined;
|
let displayToUse: Display | undefined;
|
||||||
const displays = screen.getAllDisplays();
|
const displays = screen.getAllDisplays();
|
||||||
|
|
||||||
// Single Display
|
// Single Display
|
||||||
@@ -1605,13 +1610,13 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
return getLastActiveWindow(WindowsManager.WINDOWS.filter(window => window.remoteAuthority === remoteAuthority));
|
return getLastActiveWindow(WindowsManager.WINDOWS.filter(window => window.remoteAuthority === remoteAuthority));
|
||||||
}
|
}
|
||||||
|
|
||||||
openNewWindow(context: OpenContext, options?: INewWindowOptions): ICodeWindow[] {
|
openEmptyWindow(context: OpenContext, options?: { reuse?: boolean, remoteAuthority?: string }): ICodeWindow[] {
|
||||||
let cli = this.environmentService.args;
|
let cli = this.environmentService.args;
|
||||||
const remote = options && options.remoteAuthority || undefined;
|
const remote = options && options.remoteAuthority;
|
||||||
if (cli && (cli.remote !== remote)) {
|
if (cli && (cli.remote !== remote)) {
|
||||||
cli = { ...cli, remote };
|
cli = { ...cli, remote };
|
||||||
}
|
}
|
||||||
const forceReuseWindow = options && options.reuseWindow;
|
const forceReuseWindow = options && options.reuse;
|
||||||
const forceNewWindow = !forceReuseWindow;
|
const forceNewWindow = !forceReuseWindow;
|
||||||
return this.open({ context, cli, forceEmpty: true, forceNewWindow, forceReuseWindow });
|
return this.open({ context, cli, forceEmpty: true, forceNewWindow, forceReuseWindow });
|
||||||
}
|
}
|
||||||
@@ -1665,11 +1670,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
|
|
||||||
getWindowById(windowId: number): ICodeWindow | undefined {
|
getWindowById(windowId: number): ICodeWindow | undefined {
|
||||||
const res = WindowsManager.WINDOWS.filter(window => window.id === windowId);
|
const res = WindowsManager.WINDOWS.filter(window => window.id === windowId);
|
||||||
if (res && res.length === 1) {
|
return arrays.firstOrDefault(res);
|
||||||
return res[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getWindows(): ICodeWindow[] {
|
getWindows(): ICodeWindow[] {
|
||||||
@@ -1714,9 +1715,9 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
return; // Return early if the window has been going down already
|
return; // Return early if the window has been going down already
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.button === 0) {
|
if (result.response === 0) {
|
||||||
window.reload();
|
window.reload();
|
||||||
} else if (result.button === 2) {
|
} else if (result.response === 2) {
|
||||||
this.onBeforeWindowClose(window); // 'close' event will not be fired on destroy(), so run it manually
|
this.onBeforeWindowClose(window); // 'close' event will not be fired on destroy(), so run it manually
|
||||||
window.win.destroy(); // make sure to destroy the window as it is unresponsive
|
window.win.destroy(); // make sure to destroy the window as it is unresponsive
|
||||||
}
|
}
|
||||||
@@ -1737,9 +1738,9 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
return; // Return early if the window has been going down already
|
return; // Return early if the window has been going down already
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.button === 0) {
|
if (result.response === 0) {
|
||||||
window.reload();
|
window.reload();
|
||||||
} else if (result.button === 1) {
|
} else if (result.response === 1) {
|
||||||
this.onBeforeWindowClose(window); // 'close' event will not be fired on destroy(), so run it manually
|
this.onBeforeWindowClose(window); // 'close' event will not be fired on destroy(), so run it manually
|
||||||
window.win.destroy(); // make sure to destroy the window as it has crashed
|
window.win.destroy(); // make sure to destroy the window as it has crashed
|
||||||
}
|
}
|
||||||
@@ -1761,7 +1762,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
this._onWindowClose.fire(win.id);
|
this._onWindowClose.fire(win.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
async pickFileFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
async pickFileFolderAndOpen(options: INativeOpenDialogOptions, win?: ICodeWindow): Promise<void> {
|
||||||
const title = localize('open', "Open");
|
const title = localize('open', "Open");
|
||||||
const paths = await this.dialogs.pick({ ...options, pickFolders: true, pickFiles: true, title });
|
const paths = await this.dialogs.pick({ ...options, pickFolders: true, pickFiles: true, title });
|
||||||
if (paths) {
|
if (paths) {
|
||||||
@@ -1773,7 +1774,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
}));
|
}));
|
||||||
this.open({
|
this.open({
|
||||||
context: OpenContext.DIALOG,
|
context: OpenContext.DIALOG,
|
||||||
contextWindowId: options.windowId,
|
contextWindowId: win ? win.id : undefined,
|
||||||
cli: this.environmentService.args,
|
cli: this.environmentService.args,
|
||||||
urisToOpen,
|
urisToOpen,
|
||||||
forceNewWindow: options.forceNewWindow
|
forceNewWindow: options.forceNewWindow
|
||||||
@@ -1781,14 +1782,14 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async pickFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
async pickFolderAndOpen(options: INativeOpenDialogOptions, win?: ICodeWindow): Promise<void> {
|
||||||
const title = localize('openFolder', "Open Folder");
|
const title = localize('openFolder', "Open Folder");
|
||||||
const paths = await this.dialogs.pick({ ...options, pickFolders: true, title });
|
const paths = await this.dialogs.pick({ ...options, pickFolders: true, title });
|
||||||
if (paths) {
|
if (paths) {
|
||||||
this.sendPickerTelemetry(paths, options.telemetryEventName || 'openFolder', options.telemetryExtraData);
|
this.sendPickerTelemetry(paths, options.telemetryEventName || 'openFolder', options.telemetryExtraData);
|
||||||
this.open({
|
this.open({
|
||||||
context: OpenContext.DIALOG,
|
context: OpenContext.DIALOG,
|
||||||
contextWindowId: options.windowId,
|
contextWindowId: win ? win.id : undefined,
|
||||||
cli: this.environmentService.args,
|
cli: this.environmentService.args,
|
||||||
urisToOpen: paths.map(path => ({ folderUri: URI.file(path) })),
|
urisToOpen: paths.map(path => ({ folderUri: URI.file(path) })),
|
||||||
forceNewWindow: options.forceNewWindow
|
forceNewWindow: options.forceNewWindow
|
||||||
@@ -1796,14 +1797,14 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async pickFileAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
async pickFileAndOpen(options: INativeOpenDialogOptions, win?: ICodeWindow): Promise<void> {
|
||||||
const title = localize('openFile', "Open File");
|
const title = localize('openFile', "Open File");
|
||||||
const paths = await this.dialogs.pick({ ...options, pickFiles: true, title });
|
const paths = await this.dialogs.pick({ ...options, pickFiles: true, title });
|
||||||
if (paths) {
|
if (paths) {
|
||||||
this.sendPickerTelemetry(paths, options.telemetryEventName || 'openFile', options.telemetryExtraData);
|
this.sendPickerTelemetry(paths, options.telemetryEventName || 'openFile', options.telemetryExtraData);
|
||||||
this.open({
|
this.open({
|
||||||
context: OpenContext.DIALOG,
|
context: OpenContext.DIALOG,
|
||||||
contextWindowId: options.windowId,
|
contextWindowId: win ? win.id : undefined,
|
||||||
cli: this.environmentService.args,
|
cli: this.environmentService.args,
|
||||||
urisToOpen: paths.map(path => ({ fileUri: URI.file(path) })),
|
urisToOpen: paths.map(path => ({ fileUri: URI.file(path) })),
|
||||||
forceNewWindow: options.forceNewWindow
|
forceNewWindow: options.forceNewWindow
|
||||||
@@ -1811,7 +1812,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async pickWorkspaceAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
async pickWorkspaceAndOpen(options: INativeOpenDialogOptions, win?: ICodeWindow): Promise<void> {
|
||||||
const title = localize('openWorkspaceTitle', "Open Workspace");
|
const title = localize('openWorkspaceTitle', "Open Workspace");
|
||||||
const buttonLabel = mnemonicButtonLabel(localize({ key: 'openWorkspace', comment: ['&& denotes a mnemonic'] }, "&&Open"));
|
const buttonLabel = mnemonicButtonLabel(localize({ key: 'openWorkspace', comment: ['&& denotes a mnemonic'] }, "&&Open"));
|
||||||
const filters = WORKSPACE_FILTER;
|
const filters = WORKSPACE_FILTER;
|
||||||
@@ -1820,7 +1821,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
this.sendPickerTelemetry(paths, options.telemetryEventName || 'openWorkspace', options.telemetryExtraData);
|
this.sendPickerTelemetry(paths, options.telemetryEventName || 'openWorkspace', options.telemetryExtraData);
|
||||||
this.open({
|
this.open({
|
||||||
context: OpenContext.DIALOG,
|
context: OpenContext.DIALOG,
|
||||||
contextWindowId: options.windowId,
|
contextWindowId: win ? win.id : undefined,
|
||||||
cli: this.environmentService.args,
|
cli: this.environmentService.args,
|
||||||
urisToOpen: paths.map(path => ({ workspaceUri: URI.file(path) })),
|
urisToOpen: paths.map(path => ({ workspaceUri: URI.file(path) })),
|
||||||
forceNewWindow: options.forceNewWindow
|
forceNewWindow: options.forceNewWindow
|
||||||
@@ -1842,15 +1843,15 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showMessageBox(options: Electron.MessageBoxOptions, win?: ICodeWindow): Promise<IMessageBoxResult> {
|
showMessageBox(options: MessageBoxOptions, win?: ICodeWindow): Promise<MessageBoxReturnValue> {
|
||||||
return this.dialogs.showMessageBox(options, win);
|
return this.dialogs.showMessageBox(options, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
showSaveDialog(options: Electron.SaveDialogOptions, win?: ICodeWindow): Promise<string> {
|
showSaveDialog(options: SaveDialogOptions, win?: ICodeWindow): Promise<SaveDialogReturnValue> {
|
||||||
return this.dialogs.showSaveDialog(options, win);
|
return this.dialogs.showSaveDialog(options, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
showOpenDialog(options: Electron.OpenDialogOptions, win?: ICodeWindow): Promise<string[]> {
|
showOpenDialog(options: OpenDialogOptions, win?: ICodeWindow): Promise<OpenDialogReturnValue> {
|
||||||
return this.dialogs.showOpenDialog(options, win);
|
return this.dialogs.showOpenDialog(options, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1897,10 +1898,10 @@ class Dialogs {
|
|||||||
this.noWindowDialogQueue = new Queue<void>();
|
this.noWindowDialogQueue = new Queue<void>();
|
||||||
}
|
}
|
||||||
|
|
||||||
async pick(options: IInternalNativeOpenDialogOptions): Promise<string[] | undefined> {
|
async pick(options: IInternalNativeOpenDialogOptions, win?: ICodeWindow): Promise<string[] | undefined> {
|
||||||
|
|
||||||
// Ensure dialog options
|
// Ensure dialog options
|
||||||
const dialogOptions: Electron.OpenDialogOptions = {
|
const dialogOptions: OpenDialogOptions = {
|
||||||
title: options.title,
|
title: options.title,
|
||||||
buttonLabel: options.buttonLabel,
|
buttonLabel: options.buttonLabel,
|
||||||
filters: options.filters
|
filters: options.filters
|
||||||
@@ -1928,15 +1929,15 @@ class Dialogs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show Dialog
|
// Show Dialog
|
||||||
const focusedWindow = (typeof options.windowId === 'number' ? this.windowsMainService.getWindowById(options.windowId) : undefined) || this.windowsMainService.getFocusedWindow();
|
const windowToUse = win || this.windowsMainService.getFocusedWindow();
|
||||||
|
|
||||||
const paths = await this.showOpenDialog(dialogOptions, focusedWindow);
|
const result = await this.showOpenDialog(dialogOptions, windowToUse);
|
||||||
if (paths && paths.length > 0) {
|
if (result && result.filePaths && result.filePaths.length > 0) {
|
||||||
|
|
||||||
// Remember path in storage for next time
|
// Remember path in storage for next time
|
||||||
this.stateService.setItem(Dialogs.workingDirPickerStorageKey, dirname(paths[0]));
|
this.stateService.setItem(Dialogs.workingDirPickerStorageKey, dirname(result.filePaths[0]));
|
||||||
|
|
||||||
return paths;
|
return result.filePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined; // {{SQL CARBON EDIT}} @anthonydresser strict-null-check
|
return undefined; // {{SQL CARBON EDIT}} @anthonydresser strict-null-check
|
||||||
@@ -1956,20 +1957,17 @@ class Dialogs {
|
|||||||
return windowDialogQueue;
|
return windowDialogQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
showMessageBox(options: Electron.MessageBoxOptions, window?: ICodeWindow): Promise<IMessageBoxResult> {
|
showMessageBox(options: MessageBoxOptions, window?: ICodeWindow): Promise<MessageBoxReturnValue> {
|
||||||
return this.getDialogQueue(window).queue(async () => {
|
return this.getDialogQueue(window).queue(async () => {
|
||||||
let result: Electron.MessageBoxReturnValue;
|
|
||||||
if (window) {
|
if (window) {
|
||||||
result = await dialog.showMessageBox(window.win, options);
|
return dialog.showMessageBox(window.win, options);
|
||||||
} else {
|
|
||||||
result = await dialog.showMessageBox(options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { button: result.response, checkboxChecked: result.checkboxChecked };
|
return dialog.showMessageBox(options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showSaveDialog(options: Electron.SaveDialogOptions, window?: ICodeWindow): Promise<string> {
|
showSaveDialog(options: SaveDialogOptions, window?: ICodeWindow): Promise<SaveDialogReturnValue> {
|
||||||
|
|
||||||
function normalizePath(path: string | undefined): string | undefined {
|
function normalizePath(path: string | undefined): string | undefined {
|
||||||
if (path && isMacintosh) {
|
if (path && isMacintosh) {
|
||||||
@@ -1980,18 +1978,20 @@ class Dialogs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.getDialogQueue(window).queue(async () => {
|
return this.getDialogQueue(window).queue(async () => {
|
||||||
let result: Electron.SaveDialogReturnValue;
|
let result: SaveDialogReturnValue;
|
||||||
if (window) {
|
if (window) {
|
||||||
result = await dialog.showSaveDialog(window.win, options);
|
result = await dialog.showSaveDialog(window.win, options);
|
||||||
} else {
|
} else {
|
||||||
result = await dialog.showSaveDialog(options);
|
result = await dialog.showSaveDialog(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return normalizePath(result.filePath);
|
result.filePath = normalizePath(result.filePath);
|
||||||
|
|
||||||
|
return result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showOpenDialog(options: Electron.OpenDialogOptions, window?: ICodeWindow): Promise<string[]> {
|
showOpenDialog(options: OpenDialogOptions, window?: ICodeWindow): Promise<OpenDialogReturnValue> {
|
||||||
|
|
||||||
function normalizePaths(paths: string[] | undefined): string[] | undefined {
|
function normalizePaths(paths: string[] | undefined): string[] | undefined {
|
||||||
if (paths && paths.length > 0 && isMacintosh) {
|
if (paths && paths.length > 0 && isMacintosh) {
|
||||||
@@ -2012,14 +2012,16 @@ class Dialogs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show dialog
|
// Show dialog
|
||||||
let result: Electron.OpenDialogReturnValue;
|
let result: OpenDialogReturnValue;
|
||||||
if (window) {
|
if (window) {
|
||||||
result = await dialog.showOpenDialog(window.win, options);
|
result = await dialog.showOpenDialog(window.win, options);
|
||||||
} else {
|
} else {
|
||||||
result = await dialog.showOpenDialog(options);
|
result = await dialog.showOpenDialog(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return normalizePaths(result.filePaths);
|
result.filePaths = normalizePaths(result.filePaths);
|
||||||
|
|
||||||
|
return result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2056,7 +2058,7 @@ class WorkspacesManager {
|
|||||||
|
|
||||||
// Prevent overwriting a workspace that is currently opened in another window
|
// Prevent overwriting a workspace that is currently opened in another window
|
||||||
if (findWindowOnWorkspace(this.windowsMainService.getWindows(), getWorkspaceIdentifier(path))) {
|
if (findWindowOnWorkspace(this.windowsMainService.getWindows(), getWorkspaceIdentifier(path))) {
|
||||||
const options: Electron.MessageBoxOptions = {
|
const options: MessageBoxOptions = {
|
||||||
title: product.nameLong,
|
title: product.nameLong,
|
||||||
type: 'info',
|
type: 'info',
|
||||||
buttons: [localize('ok', "OK")],
|
buttons: [localize('ok', "OK")],
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ export abstract class AbstractCodeEditorService extends Disposable implements IC
|
|||||||
return Object.keys(this._diffEditors).map(id => this._diffEditors[id]);
|
return Object.keys(this._diffEditors).map(id => this._diffEditors[id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFocusedCodeEditor(): ICodeEditor | null {
|
getFocusedCodeEditor(): ICodeEditor | undefined {
|
||||||
let editorWithWidgetFocus: ICodeEditor | null = null;
|
let editorWithWidgetFocus: ICodeEditor | undefined;
|
||||||
|
|
||||||
const editors = this.listCodeEditors();
|
const editors = this.listCodeEditors();
|
||||||
for (const editor of editors) {
|
for (const editor of editors) {
|
||||||
@@ -124,8 +124,8 @@ export abstract class AbstractCodeEditorService extends Disposable implements IC
|
|||||||
delete this._transientWatchers[w.uri];
|
delete this._transientWatchers[w.uri];
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract getActiveCodeEditor(): ICodeEditor | null;
|
abstract getActiveCodeEditor(): ICodeEditor | undefined;
|
||||||
abstract openCodeEditor(input: IResourceInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null>;
|
abstract openCodeEditor(input: IResourceInput, source: ICodeEditor | undefined, sideBySide?: boolean): Promise<ICodeEditor | undefined>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModelTransientSettingWatcher {
|
export class ModelTransientSettingWatcher {
|
||||||
|
|||||||
@@ -26,16 +26,17 @@ export interface ICodeEditorService {
|
|||||||
|
|
||||||
addCodeEditor(editor: ICodeEditor): void;
|
addCodeEditor(editor: ICodeEditor): void;
|
||||||
removeCodeEditor(editor: ICodeEditor): void;
|
removeCodeEditor(editor: ICodeEditor): void;
|
||||||
listCodeEditors(): ICodeEditor[];
|
listCodeEditors(): readonly ICodeEditor[];
|
||||||
|
|
||||||
addDiffEditor(editor: IDiffEditor): void;
|
addDiffEditor(editor: IDiffEditor): void;
|
||||||
removeDiffEditor(editor: IDiffEditor): void;
|
removeDiffEditor(editor: IDiffEditor): void;
|
||||||
listDiffEditors(): IDiffEditor[];
|
listDiffEditors(): readonly IDiffEditor[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current focused code editor (if the focus is in the editor or in an editor widget) or null.
|
* Returns the current focused code editor (if the focus is in the editor or in an editor widget) or
|
||||||
|
* `undefined` if none.
|
||||||
*/
|
*/
|
||||||
getFocusedCodeEditor(): ICodeEditor | null;
|
getFocusedCodeEditor(): ICodeEditor | undefined;
|
||||||
|
|
||||||
registerDecorationType(key: string, options: IDecorationRenderOptions, parentTypeKey?: string): void;
|
registerDecorationType(key: string, options: IDecorationRenderOptions, parentTypeKey?: string): void;
|
||||||
removeDecorationType(key: string): void;
|
removeDecorationType(key: string): void;
|
||||||
@@ -44,6 +45,6 @@ export interface ICodeEditorService {
|
|||||||
setTransientModelProperty(model: ITextModel, key: string, value: any): void;
|
setTransientModelProperty(model: ITextModel, key: string, value: any): void;
|
||||||
getTransientModelProperty(model: ITextModel, key: string): any;
|
getTransientModelProperty(model: ITextModel, key: string): any;
|
||||||
|
|
||||||
getActiveCodeEditor(): ICodeEditor | null;
|
getActiveCodeEditor(): ICodeEditor | undefined;
|
||||||
openCodeEditor(input: IResourceInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null>;
|
openCodeEditor(input: IResourceInput, source: ICodeEditor | undefined, sideBySide?: boolean): Promise<ICodeEditor | undefined>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ export abstract class CodeEditorServiceImpl extends AbstractCodeEditorService {
|
|||||||
return provider.getOptions(this, writable);
|
return provider.getOptions(this, writable);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract getActiveCodeEditor(): ICodeEditor | null;
|
abstract getActiveCodeEditor(): ICodeEditor | undefined;
|
||||||
abstract openCodeEditor(input: IResourceInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null>;
|
abstract openCodeEditor(input: IResourceInput, source: ICodeEditor | undefined, sideBySide?: boolean): Promise<ICodeEditor | undefined>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IModelDecorationOptionsProvider extends IDisposable {
|
interface IModelDecorationOptionsProvider extends IDisposable {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { equalsIgnoreCase } from 'vs/base/common/strings';
|
|||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||||
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
|
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
|
||||||
import { IOpener, IOpenerService, IValidator, IExternalUriResolver } from 'vs/platform/opener/common/opener';
|
import { IOpener, IOpenerService, IValidator, IExternalUriResolver, OpenOptions } from 'vs/platform/opener/common/opener';
|
||||||
|
|
||||||
export class OpenerService extends Disposable implements IOpenerService {
|
export class OpenerService extends Disposable implements IOpenerService {
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ export class OpenerService extends Disposable implements IOpenerService {
|
|||||||
return { dispose: remove };
|
return { dispose: remove };
|
||||||
}
|
}
|
||||||
|
|
||||||
async open(resource: URI, options?: { openToSide?: boolean, openExternal?: boolean }): Promise<boolean> {
|
async open(resource: URI, options?: OpenOptions): Promise<boolean> {
|
||||||
// no scheme ?!?
|
// no scheme ?!?
|
||||||
if (!resource.scheme) {
|
if (!resource.scheme) {
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
@@ -65,22 +65,33 @@ export class OpenerService extends Disposable implements IOpenerService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// use default openers
|
// use default openers
|
||||||
return this._doOpen(resource, options);
|
return this._doOpen(resource, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _doOpen(resource: URI, options?: { openToSide?: boolean, openExternal?: boolean }): Promise<boolean> {
|
public async resolveExternalUri(resource: URI, options?: { readonly allowTunneling?: boolean }): Promise<{ resolved: URI, dispose(): void }> {
|
||||||
|
for (const resolver of this._resolvers.toArray()) {
|
||||||
|
const result = await resolver.resolveExternalUri(resource, options);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { resolved: resource, dispose: () => { } };
|
||||||
|
}
|
||||||
|
|
||||||
|
private _doOpen(resource: URI, options: OpenOptions | undefined): Promise<boolean> {
|
||||||
|
|
||||||
const { scheme, path, query, fragment } = resource;
|
const { scheme, path, query, fragment } = resource;
|
||||||
|
|
||||||
if (equalsIgnoreCase(scheme, Schemas.mailto) || (options && options.openExternal)) {
|
if (equalsIgnoreCase(scheme, Schemas.mailto) || (options && options.openExternal)) {
|
||||||
// open default mail application
|
// open default mail application
|
||||||
return this._doOpenExternal(resource);
|
return this._doOpenExternal(resource, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (equalsIgnoreCase(scheme, Schemas.http) || equalsIgnoreCase(scheme, Schemas.https)) {
|
if (equalsIgnoreCase(scheme, Schemas.http) || equalsIgnoreCase(scheme, Schemas.https)) {
|
||||||
// open link in default browser
|
// open link in default browser
|
||||||
return this._doOpenExternal(resource);
|
return this._doOpenExternal(resource, options);
|
||||||
} else if (equalsIgnoreCase(scheme, Schemas.command)) {
|
} else if (equalsIgnoreCase(scheme, Schemas.command)) {
|
||||||
// run command or bail out if command isn't known
|
// run command or bail out if command isn't known
|
||||||
if (!CommandsRegistry.getCommand(path)) {
|
if (!CommandsRegistry.getCommand(path)) {
|
||||||
@@ -124,13 +135,9 @@ export class OpenerService extends Disposable implements IOpenerService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _doOpenExternal(resource: URI): Promise<boolean> {
|
private async _doOpenExternal(resource: URI, options: OpenOptions | undefined): Promise<boolean> {
|
||||||
for (const resolver of this._resolvers.toArray()) {
|
const { resolved } = await this.resolveExternalUri(resource, options);
|
||||||
resource = await resolver.resolveExternalUri(resource);
|
dom.windowOpenNoOpener(encodeURI(resolved.toString(true)));
|
||||||
}
|
|
||||||
|
|
||||||
dom.windowOpenNoOpener(encodeURI(resource.toString(true)));
|
|
||||||
|
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -737,7 +737,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setSelections(ranges: ISelection[], source: string = 'api'): void {
|
public setSelections(ranges: readonly ISelection[], source: string = 'api'): void {
|
||||||
if (!this._modelData) {
|
if (!this._modelData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1172,7 +1172,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
|||||||
}
|
}
|
||||||
|
|
||||||
public hasWidgetFocus(): boolean {
|
public hasWidgetFocus(): boolean {
|
||||||
return (this._editorWidgetFocus.getValue() === BooleanEventValue.True);
|
return this._focusTracker && this._focusTracker.hasFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public addContentWidget(widget: editorBrowser.IContentWidget): void {
|
public addContentWidget(widget: editorBrowser.IContentWidget): void {
|
||||||
@@ -1452,13 +1452,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
|||||||
}
|
}
|
||||||
|
|
||||||
const viewOutgoingEvents = new ViewOutgoingEvents(viewModel);
|
const viewOutgoingEvents = new ViewOutgoingEvents(viewModel);
|
||||||
viewOutgoingEvents.onDidGainFocus = () => {
|
|
||||||
this._editorTextFocus.setValue(true);
|
|
||||||
// In IE, the focus is not synchronous, so we give it a little help
|
|
||||||
this._editorWidgetFocus.setValue(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
viewOutgoingEvents.onDidScroll = (e) => this._onDidScrollChange.fire(e);
|
viewOutgoingEvents.onDidScroll = (e) => this._onDidScrollChange.fire(e);
|
||||||
|
viewOutgoingEvents.onDidGainFocus = () => this._editorTextFocus.setValue(true);
|
||||||
viewOutgoingEvents.onDidLoseFocus = () => this._editorTextFocus.setValue(false);
|
viewOutgoingEvents.onDidLoseFocus = () => this._editorTextFocus.setValue(false);
|
||||||
viewOutgoingEvents.onContextMenu = (e) => this._onContextMenu.fire(e);
|
viewOutgoingEvents.onContextMenu = (e) => this._onContextMenu.fire(e);
|
||||||
viewOutgoingEvents.onMouseDown = (e) => this._onMouseDown.fire(e);
|
viewOutgoingEvents.onMouseDown = (e) => this._onMouseDown.fire(e);
|
||||||
@@ -1548,10 +1543,6 @@ export class BooleanEventEmitter extends Disposable {
|
|||||||
this._value = BooleanEventValue.NotSet;
|
this._value = BooleanEventValue.NotSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getValue(): BooleanEventValue {
|
|
||||||
return this._value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setValue(_value: boolean) {
|
public setValue(_value: boolean) {
|
||||||
const value = (_value ? BooleanEventValue.True : BooleanEventValue.False);
|
const value = (_value ? BooleanEventValue.True : BooleanEventValue.False);
|
||||||
if (this._value === value) {
|
if (this._value === value) {
|
||||||
|
|||||||
@@ -728,7 +728,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
|||||||
this.modifiedEditor.setSelection(something);
|
this.modifiedEditor.setSelection(something);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setSelections(ranges: ISelection[]): void {
|
public setSelections(ranges: readonly ISelection[]): void {
|
||||||
this.modifiedEditor.setSelections(ranges);
|
this.modifiedEditor.setSelections(ranges);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
|
|||||||
return this._cursors.getPrimaryCursor().modelState.position;
|
return this._cursors.getPrimaryCursor().modelState.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setSelections(source: string, selections: ISelection[]): void {
|
public setSelections(source: string, selections: readonly ISelection[]): void {
|
||||||
this.setStates(source, CursorChangeReason.NotSet, CursorState.fromModelSelections(selections));
|
this.setStates(source, CursorChangeReason.NotSet, CursorState.fromModelSelections(selections));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ export class CursorState {
|
|||||||
return CursorState.fromModelState(modelState);
|
return CursorState.fromModelState(modelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static fromModelSelections(modelSelections: ISelection[]): PartialModelCursorState[] {
|
public static fromModelSelections(modelSelections: readonly ISelection[]): PartialModelCursorState[] {
|
||||||
let states: PartialModelCursorState[] = [];
|
let states: PartialModelCursorState[] = [];
|
||||||
for (let i = 0, len = modelSelections.length; i < len; i++) {
|
for (let i = 0, len = modelSelections.length; i < len; i++) {
|
||||||
states[i] = this.fromModelSelection(modelSelections[i]);
|
states[i] = this.fromModelSelection(modelSelections[i]);
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ export interface IEditor {
|
|||||||
* Set the selections for all the cursors of the editor.
|
* Set the selections for all the cursors of the editor.
|
||||||
* Cursors will be removed or added, as necessary.
|
* Cursors will be removed or added, as necessary.
|
||||||
*/
|
*/
|
||||||
setSelections(selections: ISelection[]): void;
|
setSelections(selections: readonly ISelection[]): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scroll vertically as necessary and reveal lines.
|
* Scroll vertically as necessary and reveal lines.
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ export class LanguageFeatureRegistry<T> {
|
|||||||
private readonly _entries: Entry<T>[] = [];
|
private readonly _entries: Entry<T>[] = [];
|
||||||
private readonly _onDidChange = new Emitter<number>();
|
private readonly _onDidChange = new Emitter<number>();
|
||||||
|
|
||||||
constructor() {
|
|
||||||
}
|
|
||||||
|
|
||||||
get onDidChange(): Event<number> {
|
get onDidChange(): Event<number> {
|
||||||
return this._onDidChange.event;
|
return this._onDidChange.event;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { FrankensteinMode } from 'vs/editor/common/modes/abstractMode';
|
|||||||
import { NULL_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/nullMode';
|
import { NULL_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/nullMode';
|
||||||
import { LanguagesRegistry } from 'vs/editor/common/services/languagesRegistry';
|
import { LanguagesRegistry } from 'vs/editor/common/services/languagesRegistry';
|
||||||
import { ILanguageSelection, IModeService } from 'vs/editor/common/services/modeService';
|
import { ILanguageSelection, IModeService } from 'vs/editor/common/services/modeService';
|
||||||
|
import { firstOrDefault } from 'vs/base/common/arrays';
|
||||||
|
|
||||||
class LanguageSelection extends Disposable implements ILanguageSelection {
|
class LanguageSelection extends Disposable implements ILanguageSelection {
|
||||||
|
|
||||||
@@ -96,22 +97,12 @@ export class ModeServiceImpl implements IModeService {
|
|||||||
|
|
||||||
public getModeIdByFilepathOrFirstLine(resource: URI | null, firstLine?: string): string | null {
|
public getModeIdByFilepathOrFirstLine(resource: URI | null, firstLine?: string): string | null {
|
||||||
const modeIds = this._registry.getModeIdsFromFilepathOrFirstLine(resource, firstLine);
|
const modeIds = this._registry.getModeIdsFromFilepathOrFirstLine(resource, firstLine);
|
||||||
|
return firstOrDefault(modeIds, null);
|
||||||
if (modeIds.length > 0) {
|
|
||||||
return modeIds[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getModeId(commaSeparatedMimetypesOrCommaSeparatedIds: string | undefined): string | null {
|
public getModeId(commaSeparatedMimetypesOrCommaSeparatedIds: string | undefined): string | null {
|
||||||
const modeIds = this._registry.extractModeIds(commaSeparatedMimetypesOrCommaSeparatedIds);
|
const modeIds = this._registry.extractModeIds(commaSeparatedMimetypesOrCommaSeparatedIds);
|
||||||
|
return firstOrDefault(modeIds, null);
|
||||||
if (modeIds.length > 0) {
|
|
||||||
return modeIds[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getLanguageIdentifier(modeId: string | LanguageId): LanguageIdentifier | null {
|
public getLanguageIdentifier(modeId: string | LanguageId): LanguageIdentifier | null {
|
||||||
@@ -164,12 +155,7 @@ export class ModeServiceImpl implements IModeService {
|
|||||||
|
|
||||||
private _getModeIdByLanguageName(languageName: string): string | null {
|
private _getModeIdByLanguageName(languageName: string): string | null {
|
||||||
const modeIds = this._registry.getModeIdsFromLanguageName(languageName);
|
const modeIds = this._registry.getModeIdsFromLanguageName(languageName);
|
||||||
|
return firstOrDefault(modeIds, null);
|
||||||
if (modeIds.length > 0) {
|
|
||||||
return modeIds[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getOrCreateMode(modeId: string): IMode {
|
private _getOrCreateMode(modeId: string): IMode {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export class MinimapTokensColorTracker {
|
|||||||
private _colors!: RGBA8[];
|
private _colors!: RGBA8[];
|
||||||
private _backgroundIsLight!: boolean;
|
private _backgroundIsLight!: boolean;
|
||||||
|
|
||||||
private _onDidChange = new Emitter<void>();
|
private readonly _onDidChange = new Emitter<void>();
|
||||||
public readonly onDidChange: Event<void> = this._onDidChange.event;
|
public readonly onDidChange: Event<void> = this._onDidChange.event;
|
||||||
|
|
||||||
private constructor() {
|
private constructor() {
|
||||||
|
|||||||
@@ -244,9 +244,6 @@ export class ViewTokensChangedEvent {
|
|||||||
export class ViewThemeChangedEvent {
|
export class ViewThemeChangedEvent {
|
||||||
|
|
||||||
public readonly type = ViewEventType.ViewThemeChanged;
|
public readonly type = ViewEventType.ViewThemeChanged;
|
||||||
|
|
||||||
constructor() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ViewTokensColorsChangedEvent {
|
export class ViewTokensColorsChangedEvent {
|
||||||
@@ -270,9 +267,6 @@ export class ViewZonesChangedEvent {
|
|||||||
export class ViewLanguageConfigurationEvent {
|
export class ViewLanguageConfigurationEvent {
|
||||||
|
|
||||||
public readonly type = ViewEventType.ViewLanguageConfigurationChanged;
|
public readonly type = ViewEventType.ViewLanguageConfigurationChanged;
|
||||||
|
|
||||||
constructor() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ViewEvent = (
|
export type ViewEvent = (
|
||||||
|
|||||||
@@ -1401,9 +1401,6 @@ class OverviewRulerDecorations {
|
|||||||
|
|
||||||
readonly result: IOverviewRulerDecorations = Object.create(null);
|
readonly result: IOverviewRulerDecorations = Object.create(null);
|
||||||
|
|
||||||
constructor() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public accept(color: string, startLineNumber: number, endLineNumber: number, lane: number): void {
|
public accept(color: string, startLineNumber: number, endLineNumber: number, lane: number): void {
|
||||||
let prev = this.result[color];
|
let prev = this.result[color];
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
.monaco-editor .lightbulb-glyph {
|
.monaco-editor .codicon-lightbulb {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -12,25 +12,7 @@
|
|||||||
padding-left: 2px;
|
padding-left: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.monaco-editor .lightbulb-glyph:hover {
|
.monaco-editor .codicon-lightbulb:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
/* transform: scale(1.3, 1.3); */
|
/* transform: scale(1.3, 1.3); */
|
||||||
}
|
}
|
||||||
|
|
||||||
.monaco-editor.vs .lightbulb-glyph {
|
|
||||||
background: url('lightbulb-light.svg') center center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
.monaco-editor.vs .lightbulb-glyph.autofixable {
|
|
||||||
background: url('lightbulb-autofix-light.svg') center center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
.monaco-editor.vs-dark .lightbulb-glyph,
|
|
||||||
.monaco-editor.hc-black .lightbulb-glyph {
|
|
||||||
background: url('lightbulb-dark.svg') center center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
.monaco-editor.vs-dark .lightbulb-glyph.autofixable,
|
|
||||||
.monaco-editor.hc-black .lightbulb-glyph.autofixable {
|
|
||||||
background: url('lightbulb-autofix-dark.svg') center center no-repeat;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import { CodeActionSet } from 'vs/editor/contrib/codeAction/codeAction';
|
|||||||
import * as nls from 'vs/nls';
|
import * as nls from 'vs/nls';
|
||||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||||
|
import { registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
|
||||||
|
import { editorLightBulbForeground, editorLightBulbAutoFixForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||||
|
|
||||||
namespace LightBulbState {
|
namespace LightBulbState {
|
||||||
|
|
||||||
@@ -57,7 +59,7 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
|
|||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this._domNode = document.createElement('div');
|
this._domNode = document.createElement('div');
|
||||||
this._domNode.className = 'lightbulb-glyph';
|
this._domNode.className = 'codicon codicon-lightbulb';
|
||||||
|
|
||||||
this._editor.addContentWidget(this);
|
this._editor.addContentWidget(this);
|
||||||
|
|
||||||
@@ -175,7 +177,7 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
|
|||||||
position: { lineNumber: effectiveLineNumber, column: 1 },
|
position: { lineNumber: effectiveLineNumber, column: 1 },
|
||||||
preference: LightBulbWidget._posPref
|
preference: LightBulbWidget._posPref
|
||||||
});
|
});
|
||||||
dom.toggleClass(this._domNode, 'autofixable', actions.hasAutoFix);
|
dom.toggleClass(this._domNode, 'codicon-lightbulb-autofix', actions.hasAutoFix);
|
||||||
this._editor.layoutContentWidget(this);
|
this._editor.layoutContentWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,3 +201,27 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
|
||||||
|
|
||||||
|
// Lightbulb Icon
|
||||||
|
const editorLightBulbForegroundColor = theme.getColor(editorLightBulbForeground);
|
||||||
|
if (editorLightBulbForegroundColor) {
|
||||||
|
collector.addRule(`
|
||||||
|
.monaco-workbench .contentWidgets .codicon-lightbulb,
|
||||||
|
.monaco-workbench .markers-panel-container .codicon-lightbulb {
|
||||||
|
color: ${editorLightBulbForegroundColor};
|
||||||
|
}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lightbulb Auto Fix Icon
|
||||||
|
const editorLightBulbAutoFixForegroundColor = theme.getColor(editorLightBulbAutoFixForeground);
|
||||||
|
if (editorLightBulbAutoFixForegroundColor) {
|
||||||
|
collector.addRule(`
|
||||||
|
.monaco-workbench .contentWidgets .codicon-lightbulb-autofix,
|
||||||
|
.monaco-workbench .markers-panel-container .codicon-lightbulb-autofix {
|
||||||
|
color: ${editorLightBulbAutoFixForegroundColor};
|
||||||
|
}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user