Revert "Merge from vscode ada4bddb8edc69eea6ebaaa0e88c5f903cbd43d8 (#5529)" (#5553)

This reverts commit 5d44b6a6a7.
This commit is contained in:
Anthony Dresser
2019-05-20 17:07:32 -07:00
committed by GitHub
parent 1315b8e42a
commit c9a4f8f664
325 changed files with 3332 additions and 4501 deletions

View File

@@ -1,126 +0,0 @@
# cleanup rules for native node modules, .gitignore style
fsevents/binding.gyp
fsevents/fsevents.cc
fsevents/build/**
fsevents/src/**
fsevents/test/**
!fsevents/**/*.node
vscode-sqlite3/binding.gyp
vscode-sqlite3/benchmark/**
vscode-sqlite3/cloudformation/**
vscode-sqlite3/deps/**
vscode-sqlite3/test/**
vscode-sqlite3/build/**
vscode-sqlite3/src/**
!vscode-sqlite3/build/Release/*.node
oniguruma/binding.gyp
oniguruma/build/**
oniguruma/src/**
oniguruma/deps/**
!oniguruma/build/Release/*.node
!oniguruma/src/*.js
windows-mutex/binding.gyp
windows-mutex/build/**
windows-mutex/src/**
!windows-mutex/**/*.node
native-keymap/binding.gyp
native-keymap/build/**
native-keymap/src/**
native-keymap/deps/**
!native-keymap/build/Release/*.node
native-is-elevated/binding.gyp
native-is-elevated/build/**
native-is-elevated/src/**
native-is-elevated/deps/**
!native-is-elevated/build/Release/*.node
native-watchdog/binding.gyp
native-watchdog/build/**
native-watchdog/src/**
!native-watchdog/build/Release/*.node
spdlog/binding.gyp
spdlog/build/**
spdlog/deps/**
spdlog/src/**
spdlog/test/**
!spdlog/build/Release/*.node
jschardet/dist/**
windows-foreground-love/binding.gyp
windows-foreground-love/build/**
windows-foreground-love/src/**
!windows-foreground-love/**/*.node
windows-process-tree/binding.gyp
windows-process-tree/build/**
windows-process-tree/src/**
!windows-process-tree/**/*.node
gc-signals/binding.gyp
gc-signals/build/**
gc-signals/src/**
gc-signals/deps/**
!gc-signals/build/Release/*.node
!gc-signals/src/index.js
keytar/binding.gyp
keytar/build/**
keytar/src/**
keytar/script/**
keytar/node_modules/**
!keytar/**/*.node
node-pty/binding.gyp
node-pty/build/**
node-pty/src/**
node-pty/tools/**
!node-pty/build/Release/*.exe
!node-pty/build/Release/*.dll
!node-pty/build/Release/*.node
chart.js/node_modules/**
emmet/node_modules/**
pty.js/build/**
!pty.js/build/Release/**
jquery-ui/external/**
jquery-ui/demos/**
core-js/**/**
slickgrid/node_modules/**
slickgrid/examples/**
vscode-nsfw/binding.gyp
vscode-nsfw/build/**
vscode-nsfw/src/**
vscode-nsfw/openpa/**
vscode-nsfw/includes/**
!vscode-nsfw/build/Release/*.node
!vscode-nsfw/**/*.a
vsda/binding.gyp
vsda/README.md
vsda/build/**
vsda/*.bat
vsda/*.sh
vsda/*.cpp
vsda/*.h
!vsda/build/Release/vsda.node
vscode-windows-ca-certs/**/*
!vscode-windows-ca-certs/package.json
!vscode-windows-ca-certs/**/*.node
node-addon-api/**/*

View File

@@ -7,21 +7,15 @@ steps:
inputs:
versionSpec: "1.10.1"
- task: AzureKeyVault@1
displayName: 'Azure Key Vault: Get Secrets'
inputs:
azureSubscription: 'vscode-builds-subscription'
KeyVaultName: vscode
- script: |
set -e
cat << EOF > ~/.netrc
machine monacotools.visualstudio.com
password $(devops-pat)
password $(VSO_PAT)
machine github.com
login vscode
password $(github-distro-mixin-password)
password $(VSCODE_MIXIN_PASSWORD)
EOF
git config user.email "vscode@microsoft.com"
@@ -40,8 +34,8 @@ steps:
- script: |
set -e
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
AZURE_STORAGE_ACCESS_KEY="$(ticino-storage-key)" \
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" \
AZURE_STORAGE_ACCESS_KEY="$(AZURE_STORAGE_ACCESS_KEY)" \
./build/azure-pipelines/darwin/build.sh
displayName: Build
@@ -83,11 +77,11 @@ steps:
- script: |
set -e
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \
AZURE_STORAGE_ACCESS_KEY="$(ticino-storage-key)" \
AZURE_STORAGE_ACCESS_KEY_2="$(vscode-storage-key)" \
VSCODE_HOCKEYAPP_TOKEN="$(vscode-hockeyapp-token)" \
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" \
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
AZURE_STORAGE_ACCESS_KEY="$(AZURE_STORAGE_ACCESS_KEY)" \
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
VSCODE_HOCKEYAPP_TOKEN="$(VSCODE_HOCKEYAPP_TOKEN)" \
./build/azure-pipelines/darwin/publish.sh
displayName: Publish

View File

@@ -10,19 +10,13 @@ steps:
inputs:
versionSpec: "10.15.1"
- task: AzureKeyVault@1
displayName: 'Azure Key Vault: Get Secrets'
inputs:
azureSubscription: 'vscode-builds-subscription'
KeyVaultName: vscode
- script: |
set -e
cat << EOF > ~/.netrc
machine github.com
login vscode
password $(github-distro-mixin-password)
password $(VSCODE_MIXIN_PASSWORD)
EOF
git config user.email "vscode@microsoft.com"

View File

@@ -7,12 +7,6 @@ steps:
inputs:
versionSpec: "1.10.1"
- task: AzureKeyVault@1
displayName: 'Azure Key Vault: Get Secrets'
inputs:
azureSubscription: 'vscode-builds-subscription'
KeyVaultName: vscode
- script: |
set -e
export npm_config_arch="$(VSCODE_ARCH)"
@@ -22,10 +16,10 @@ steps:
cat << EOF > ~/.netrc
machine monacotools.visualstudio.com
password $(devops-pat)
password $(VSO_PAT)
machine github.com
login vscode
password $(github-distro-mixin-password)
password $(VSCODE_MIXIN_PASSWORD)
EOF
git config user.email "vscode@microsoft.com"
@@ -44,7 +38,7 @@ steps:
- script: |
set -e
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" \
./build/azure-pipelines/linux/build.sh
displayName: Build
@@ -61,10 +55,10 @@ steps:
- script: |
set -e
AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \
AZURE_STORAGE_ACCESS_KEY_2="$(vscode-storage-key)" \
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
VSCODE_HOCKEYAPP_TOKEN="$(vscode-hockeyapp-token)" \
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" \
VSCODE_HOCKEYAPP_TOKEN="$(VSCODE_HOCKEYAPP_TOKEN)" \
./build/azure-pipelines/linux/publish.sh
displayName: Publish

View File

@@ -7,12 +7,6 @@ steps:
inputs:
versionSpec: "1.10.1"
- task: AzureKeyVault@1
displayName: 'Azure Key Vault: Get Secrets'
inputs:
azureSubscription: 'vscode-builds-subscription'
KeyVaultName: vscode
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact'
inputs:
@@ -50,6 +44,6 @@ steps:
(cd $SNAP_ROOT/code-* && sudo snapcraft snap --output "$SNAP_PATH")
# Publish snap package
AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \
AZURE_STORAGE_ACCESS_KEY_2="$(vscode-storage-key)" \
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
node build/azure-pipelines/common/publish.js "$VSCODE_QUALITY" "linux-snap-$ARCH" package "$SNAP_FILENAME" "$VERSION" true "$SNAP_PATH"

View File

@@ -1,11 +1,9 @@
resources:
containers:
- container: vscode-x64
endpoint: VSCodeHub
image: vscodehub.azurecr.io/vscode-linux-build-agent:x64
image: joaomoreno/vscode-linux-build-agent:x64
- container: vscode-ia32
endpoint: VSCodeHub
image: vscodehub.azurecr.io/vscode-linux-build-agent:ia32
image: joaomoreno/vscode-linux-build-agent:ia32
- container: snapcraft
image: snapcore/snapcraft

View File

@@ -7,18 +7,12 @@ steps:
inputs:
versionSpec: "1.10.1"
- task: AzureKeyVault@1
displayName: 'Azure Key Vault: Get Secrets'
inputs:
azureSubscription: 'vscode-builds-subscription'
KeyVaultName: vscode
- script: |
set -e
(cd build ; yarn)
AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \
AZURE_STORAGE_ACCESS_KEY_2="$(vscode-storage-key)" \
MOONCAKE_STORAGE_ACCESS_KEY="$(vscode-mooncake-storage-key)" \
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
node build/azure-pipelines/common/sync-mooncake.js "$VSCODE_QUALITY"

View File

@@ -12,16 +12,10 @@ steps:
versionSpec: '2.x'
addToPath: true
- task: AzureKeyVault@1
displayName: 'Azure Key Vault: Get Secrets'
inputs:
azureSubscription: 'vscode-builds-subscription'
KeyVaultName: vscode
- powershell: |
. build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
"machine monacotools.visualstudio.com`npassword $(devops-pat)`nmachine github.com`nlogin vscode`npassword $(github-distro-mixin-password)" | Out-File "$env:USERPROFILE\_netrc" -Encoding ASCII
"machine monacotools.visualstudio.com`npassword $(VSO_PAT)`nmachine github.com`nlogin vscode`npassword $(VSCODE_MIXIN_PASSWORD)" | Out-File "$env:USERPROFILE\_netrc" -Encoding ASCII
$env:npm_config_arch="$(VSCODE_ARCH)"
$env:CHILD_CONCURRENCY="1"
@@ -42,7 +36,7 @@ steps:
- powershell: |
. build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
$env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
$env:VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)"
.\build\azure-pipelines\win32\build.ps1
displayName: Build
@@ -132,15 +126,15 @@ steps:
- powershell: |
$ErrorActionPreference = "Stop"
.\build\azure-pipelines\win32\import-esrp-auth-cert.ps1 -AuthCertificateBase64 $(esrp-auth-certificate) -AuthCertificateKey $(esrp-auth-certificate-key)
.\build\azure-pipelines\win32\import-esrp-auth-cert.ps1 -AuthCertificateBase64 $(ESRP_AUTH_CERTIFICATE) -AuthCertificateKey $(ESRP_AUTH_CERTIFICATE_KEY)
displayName: Import ESRP Auth Certificate
- powershell: |
. build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
$env:AZURE_STORAGE_ACCESS_KEY_2 = "$(vscode-storage-key)"
$env:AZURE_DOCUMENTDB_MASTERKEY = "$(builds-docdb-key-readwrite)"
$env:VSCODE_HOCKEYAPP_TOKEN = "$(vscode-hockeyapp-token)"
$env:AZURE_STORAGE_ACCESS_KEY_2 = "$(AZURE_STORAGE_ACCESS_KEY_2)"
$env:AZURE_DOCUMENTDB_MASTERKEY = "$(AZURE_DOCUMENTDB_MASTERKEY)"
$env:VSCODE_HOCKEYAPP_TOKEN = "$(VSCODE_HOCKEYAPP_TOKEN)"
.\build\azure-pipelines\win32\publish.ps1
displayName: Publish

View File

@@ -335,7 +335,33 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
const deps = gulp.src(depsSrc, { base: '.', dot: true })
.pipe(filter(['**', '!**/package-lock.json']))
.pipe(util.cleanNodeModules(path.join(__dirname, '.nativeignore')))
.pipe(util.cleanNodeModule('fsevents', ['binding.gyp', 'fsevents.cc', 'build/**', 'src/**', 'test/**'], ['**/*.node']))
.pipe(util.cleanNodeModule('vscode-sqlite3', ['binding.gyp', 'benchmark/**', 'cloudformation/**', 'deps/**', 'test/**', 'build/**', 'src/**'], ['build/Release/*.node']))
.pipe(util.cleanNodeModule('oniguruma', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['build/Release/*.node', 'src/*.js']))
.pipe(util.cleanNodeModule('windows-mutex', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
.pipe(util.cleanNodeModule('native-keymap', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['build/Release/*.node']))
.pipe(util.cleanNodeModule('native-is-elevated', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['build/Release/*.node']))
.pipe(util.cleanNodeModule('native-watchdog', ['binding.gyp', 'build/**', 'src/**'], ['build/Release/*.node']))
.pipe(util.cleanNodeModule('spdlog', ['binding.gyp', 'build/**', 'deps/**', 'src/**', 'test/**'], ['build/Release/*.node']))
.pipe(util.cleanNodeModule('jschardet', ['dist/**']))
.pipe(util.cleanNodeModule('windows-foreground-love', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
.pipe(util.cleanNodeModule('windows-process-tree', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
.pipe(util.cleanNodeModule('gc-signals', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['build/Release/*.node', 'src/index.js']))
.pipe(util.cleanNodeModule('keytar', ['binding.gyp', 'build/**', 'src/**', 'script/**', 'node_modules/**'], ['**/*.node']))
.pipe(util.cleanNodeModule('node-pty', ['binding.gyp', 'build/**', 'src/**', 'tools/**'], ['build/Release/*.exe', 'build/Release/*.dll', 'build/Release/*.node']))
// {{SQL CARBON EDIT}}
.pipe(util.cleanNodeModule('chart.js', ['node_modules/**'], undefined))
.pipe(util.cleanNodeModule('emmet', ['node_modules/**'], undefined))
.pipe(util.cleanNodeModule('pty.js', ['build/**'], ['build/Release/**']))
.pipe(util.cleanNodeModule('jquery-ui', ['external/**', 'demos/**'], undefined))
.pipe(util.cleanNodeModule('core-js', ['**/**'], undefined))
.pipe(util.cleanNodeModule('slickgrid', ['node_modules/**', 'examples/**'], undefined))
.pipe(util.cleanNodeModule('nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a']))
.pipe(util.cleanNodeModule('vscode-nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['build/Release/*.node', '**/*.a']))
// {{SQL CARBON EDIT}} - End
.pipe(util.cleanNodeModule('vsda', ['binding.gyp', 'README.md', 'build/**', '*.bat', '*.sh', '*.cpp', '*.h'], ['build/Release/vsda.node']))
.pipe(util.cleanNodeModule('vscode-windows-ca-certs', ['**/*'], ['package.json', '**/*.node']))
.pipe(util.cleanNodeModule('node-addon-api', ['**/*']))
.pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*'], 'app/node_modules.asar'));
// {{SQL CARBON EDIT}}
@@ -354,7 +380,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
], { base: '.', dot: true });
let all = es.merge(
packageJsonStream,
packageJsonStream,
productJsonStream,
license,
api,

View File

@@ -306,7 +306,9 @@ function packageExtensionsStream(optsIn) {
..._.flatten(extensionsProductionDependencies.map((d) => path.relative(root, d.path)).map((d) => [`${d}/**`, `!${d}/**/{test,tests}/**`])),
];
const localExtensionDependencies = () => gulp.src(extensionDepsSrc, { base: '.', dot: true })
.pipe(filter(['**', '!**/package-lock.json']));
.pipe(filter(['**', '!**/package-lock.json']))
.pipe(util2.cleanNodeModule('account-provider-azure', ['node_modules/date-utils/doc/**', 'node_modules/adal_node/node_modules/**'], undefined))
.pipe(util2.cleanNodeModule('typescript', ['**/**'], undefined));
// Original code commented out here
// const localExtensionDependencies = () => gulp.src('extensions/node_modules/**', { base: '.' });
// const marketplaceExtensions = () => es.merge(

View File

@@ -370,6 +370,8 @@ export function packageExtensionsStream(optsIn?: IPackageExtensionsOptions): Nod
const localExtensionDependencies = () => gulp.src(extensionDepsSrc, { base: '.', dot: true })
.pipe(filter(['**', '!**/package-lock.json']))
.pipe(util2.cleanNodeModule('account-provider-azure', ['node_modules/date-utils/doc/**', 'node_modules/adal_node/node_modules/**'], undefined))
.pipe(util2.cleanNodeModule('typescript', ['**/**'], undefined));
// Original code commented out here
// const localExtensionDependencies = () => gulp.src('extensions/node_modules/**', { base: '.' });

View File

@@ -8,6 +8,7 @@ const es = require("event-stream");
const debounce = require("debounce");
const _filter = require("gulp-filter");
const rename = require("gulp-rename");
const _ = require("underscore");
const path = require("path");
const fs = require("fs");
const _rimraf = require("rimraf");
@@ -99,18 +100,22 @@ function skipDirectories() {
});
}
exports.skipDirectories = skipDirectories;
function cleanNodeModules(rulePath) {
const rules = fs.readFileSync(rulePath, 'utf8')
.split(/\r?\n/g)
.map(line => line.trim())
.filter(line => line && !/^#/.test(line));
const excludes = rules.filter(line => !/^!/.test(line)).map(line => `!**/node_modules/${line}`);
const includes = rules.filter(line => /^!/.test(line)).map(line => `**/node_modules/${line.substr(1)}`);
function cleanNodeModule(name, excludes, includes) {
const toGlob = (path) => '**/node_modules/' + name + (path ? '/' + path : '');
const negate = (str) => '!' + str;
const allFilter = _filter(toGlob('**'), { restore: true });
const globs = [toGlob('**')].concat(excludes.map(_.compose(negate, toGlob)));
const input = es.through();
const output = es.merge(input.pipe(_filter(['**', ...excludes])), input.pipe(_filter(includes)));
const nodeModuleInput = input.pipe(allFilter);
let output = nodeModuleInput.pipe(_filter(globs));
if (includes) {
const includeGlobs = includes.map(toGlob);
output = es.merge(output, nodeModuleInput.pipe(_filter(includeGlobs)));
}
output = output.pipe(allFilter.restore);
return es.duplex(input, output);
}
exports.cleanNodeModules = cleanNodeModules;
exports.cleanNodeModule = cleanNodeModule;
function loadSourcemaps() {
const input = es.through();
const output = input

View File

@@ -132,21 +132,23 @@ export function skipDirectories(): NodeJS.ReadWriteStream {
});
}
export function cleanNodeModules(rulePath: string): NodeJS.ReadWriteStream {
const rules = fs.readFileSync(rulePath, 'utf8')
.split(/\r?\n/g)
.map(line => line.trim())
.filter(line => line && !/^#/.test(line));
export function cleanNodeModule(name: string, excludes: string[], includes?: string[]): NodeJS.ReadWriteStream {
const toGlob = (path: string) => '**/node_modules/' + name + (path ? '/' + path : '');
const negate = (str: string) => '!' + str;
const excludes = rules.filter(line => !/^!/.test(line)).map(line => `!**/node_modules/${line}`);
const includes = rules.filter(line => /^!/.test(line)).map(line => `**/node_modules/${line.substr(1)}`);
const allFilter = _filter(toGlob('**'), { restore: true });
const globs = [toGlob('**')].concat(excludes.map(_.compose(negate, toGlob) as (x: string) => string));
const input = es.through();
const output = es.merge(
input.pipe(_filter(['**', ...excludes])),
input.pipe(_filter(includes))
);
const nodeModuleInput = input.pipe(allFilter);
let output: NodeJS.ReadWriteStream = nodeModuleInput.pipe(_filter(globs));
if (includes) {
const includeGlobs = includes.map(toGlob);
output = es.merge(output, nodeModuleInput.pipe(_filter(includeGlobs)));
}
output = output.pipe(allFilter.restore);
return es.duplex(input, output);
}

View File

@@ -60,18 +60,6 @@ interface PreviewStyleLoadErrorMessage extends WebviewMessage {
};
}
export class PreviewDocumentVersion {
public constructor(
public readonly resource: vscode.Uri,
public readonly version: number,
) { }
public equals(other: PreviewDocumentVersion): boolean {
return this.resource.fsPath === other.resource.fsPath
&& this.version === other.version;
}
}
export class MarkdownPreview extends Disposable {
public static viewType = 'markdown.preview';
@@ -83,7 +71,7 @@ export class MarkdownPreview extends Disposable {
private throttleTimer: any;
private line: number | undefined = undefined;
private firstUpdate = true;
private currentVersion?: PreviewDocumentVersion;
private currentVersion?: { resource: vscode.Uri, version: number };
private forceUpdate = false;
private isScrolling = false;
private _disposed: boolean = false;
@@ -401,8 +389,7 @@ export class MarkdownPreview extends Disposable {
return;
}
const pendingVersion = new PreviewDocumentVersion(resource, document.version);
if (!this.forceUpdate && this.currentVersion && this.currentVersion.equals(pendingVersion)) {
if (!this.forceUpdate && this.currentVersion && this.currentVersion.resource.fsPath === resource.fsPath && this.currentVersion.version === document.version) {
if (this.line) {
this.updateForView(resource, this.line);
}
@@ -410,14 +397,10 @@ export class MarkdownPreview extends Disposable {
}
this.forceUpdate = false;
this.currentVersion = pendingVersion;
this.currentVersion = { resource, version: document.version };
if (this._resource === resource) {
const content = await this._contentProvider.provideTextDocumentContent(document, this._previewConfigurations, this.line, this.state);
// Another call to `doUpdate` may have happened.
// Make sure we are still updating for the correct document
if (this.currentVersion && this.currentVersion.equals(pendingVersion)) {
this.setContent(content);
}
this.setContent(content);
}
}

View File

@@ -3,9 +3,9 @@
"version": "0.0.1",
"description": "Dependencies shared by all extensions",
"dependencies": {
"typescript": "3.5.0-dev.20190517"
"typescript": "3.4.5"
},
"scripts": {
"postinstall": "node ./postinstall"
}
}
}

View File

@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/PowerShell/EditorSyntax/commit/44eac8702f3cbe55a4ec70c1fdb163d42b4162fc",
"version": "https://github.com/PowerShell/EditorSyntax/commit/12b7d7257eb493e45a9af0af9094ec0c2a996712",
"name": "PowerShell",
"scopeName": "source.powershell",
"patterns": [
@@ -252,7 +252,7 @@
]
},
"attribute": {
"begin": "(\\[)\\s*\\b(?i)(cmdletbinding|alias|outputtype|parameter|validatenotnull|validatenotnullorempty|validatecount|validateset|allownull|allowemptycollection|allowemptystring|validatescript|validaterange|validatepattern|validatelength|supportswildcards)\\b",
"begin": "(\\[)\\s*\\b(?i)(cmdletbinding|alias|outputtype|parameter|validatenotnull|validatenotnullorempty|validatecount|validateset|allownull|allowemptycollection|allowemptystring|validatescript|validaterange|validatepattern|validatelength)\\b",
"beginCaptures": {
"1": {
"name": "punctuation.section.bracket.begin.powershell"
@@ -283,6 +283,33 @@
}
},
"patterns": [
{
"include": "#variable"
},
{
"include": "#variableNoProperty"
},
{
"include": "#hashtable"
},
{
"include": "#scriptblock"
},
{
"include": "#doubleQuotedStringEscapes"
},
{
"include": "#doubleQuotedString"
},
{
"include": "#type"
},
{
"include": "#numericConstant"
},
{
"include": "#doubleQuotedString"
},
{
"include": "$self"
},
@@ -296,6 +323,17 @@
"name": "keyword.operator.assignment.powershell"
}
}
},
{
"begin": "(?<!')'",
"end": "'(?!')",
"name": "string.quoted.single.powershell",
"patterns": [
{
"match": "''",
"name": "constant.character.escape.powershell"
}
]
}
]
}
@@ -364,31 +402,15 @@
"doubleQuotedStringEscapes": {
"patterns": [
{
"match": "`[`0abefnrtv\"'$]",
"match": "`[0abnfrvt\"'$`]",
"name": "constant.character.escape.powershell"
},
{
"include": "#unicodeEscape"
},
{
"match": "\"\"",
"name": "constant.character.escape.powershell"
}
]
},
"unicodeEscape": {
"comment": "`u{xxxx} added in PowerShell 6.0",
"patterns": [
{
"match": "`u\\{(?:(?:10)?([0-9a-fA-F]){1,4}|0?\\g<1>{1,5})}",
"name": "constant.character.escape.powershell"
},
{
"match": "`u(?:\\{[0-9a-fA-F]{,6}.)?",
"name": "invalid.character.escape.powershell"
}
]
},
"function": {
"begin": "^(?:\\s*+)(?i)(function|filter|configuration|workflow)\\s+(?:(global|local|script|private):)?((?:\\p{L}|\\d|_|-|\\.)+)",
"beginCaptures": {
@@ -622,9 +644,6 @@
},
{
"captures": {
"0": {
"name": "support.variable.automatic.powershell"
},
"1": {
"name": "keyword.other.variable.definition.powershell"
},
@@ -636,7 +655,7 @@
}
},
"comment": "Automatic variables are not constants, but they are read-only. In monokai (default) color schema support.variable doesn't have color, so we use constant.",
"match": "(\\$)((?:[$^?])|(?i:_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This)\\b)((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
"match": "(\\$)(?i:(\\$|\\^|\\?|_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?\\b"
},
{
"captures": {
@@ -814,7 +833,7 @@
}
},
"comment": "Automatic variables are not constants, but they are read-only...",
"match": "(\\$)((?:[$^?])|(?i:_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This)\\b)"
"match": "(\\$)(?i:(\\$|\\^|\\?|_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This))\\b"
},
{
"captures": {
@@ -846,7 +865,7 @@
"name": "entity.name.function.invocation.powershell"
}
},
"match": "(?i:(\\$)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))"
"match": "(?i:(\\$|@)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))"
},
{
"captures": {
@@ -962,6 +981,9 @@
{
"include": "#variableNoProperty"
},
{
"include": "#variable"
},
{
"include": "#doubleQuotedStringEscapes"
},

View File

@@ -694,24 +694,24 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell support.variable.automatic.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.variable: #9CDCFE"
"dark_plus": null,
"light_plus": null,
"dark_vs": null,
"light_vs": null,
"hc_black": "keyword: #569CD6"
}
},
{
"c": "_",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell support.variable.automatic.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell support.constant.automatic.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.variable: #9CDCFE"
"dark_plus": null,
"light_plus": null,
"dark_vs": null,
"light_vs": null,
"hc_black": "default: #FFFFFF"
}
},
{
@@ -1068,24 +1068,24 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.variable.automatic.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.variable: #9CDCFE"
"dark_plus": null,
"light_plus": null,
"dark_vs": null,
"light_vs": null,
"hc_black": "keyword: #569CD6"
}
},
{
"c": "_",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.variable.automatic.powershell",
"t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.constant.automatic.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.variable: #9CDCFE"
"dark_plus": null,
"light_plus": null,
"dark_vs": null,
"light_vs": null,
"hc_black": "default: #FFFFFF"
}
},
{
@@ -1266,24 +1266,24 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.variable.automatic.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.variable: #9CDCFE"
"dark_plus": null,
"light_plus": null,
"dark_vs": null,
"light_vs": null,
"hc_black": "keyword: #569CD6"
}
},
{
"c": "_",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.variable.automatic.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.constant.automatic.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.variable: #9CDCFE"
"dark_plus": null,
"light_plus": null,
"dark_vs": null,
"light_vs": null,
"hc_black": "default: #FFFFFF"
}
},
{
@@ -1431,24 +1431,24 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.variable.automatic.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.variable: #9CDCFE"
"dark_plus": null,
"light_plus": null,
"dark_vs": null,
"light_vs": null,
"hc_black": "keyword: #569CD6"
}
},
{
"c": "matches",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.variable.automatic.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.constant.automatic.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.variable: #9CDCFE"
"dark_plus": null,
"light_plus": null,
"dark_vs": null,
"light_vs": null,
"hc_black": "default: #FFFFFF"
}
},
{
@@ -1508,24 +1508,24 @@
},
{
"c": "$",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.variable.automatic.powershell punctuation.definition.variable.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell keyword.other.variable.definition.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.variable: #9CDCFE"
"dark_plus": null,
"light_plus": null,
"dark_vs": null,
"light_vs": null,
"hc_black": "keyword: #569CD6"
}
},
{
"c": "matches",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.variable.automatic.powershell",
"t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell support.constant.automatic.powershell",
"r": {
"dark_plus": "support.variable: #9CDCFE",
"light_plus": "support.variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.variable: #9CDCFE"
"dark_plus": null,
"light_plus": null,
"dark_vs": null,
"light_vs": null,
"hc_black": "default: #FFFFFF"
}
},
{

View File

@@ -8,7 +8,8 @@
"vscode": "*"
},
"scripts": {
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-colorize-tests ./tsconfig.json"
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-colorize-tests ./tsconfig.json",
"postinstall": "node ./node_modules/vscode/bin/install"
},
"devDependencies": {
"@types/node": "^10.12.21",

View File

@@ -4,4 +4,3 @@
*--------------------------------------------------------------------------------------------*/
/// <reference types='@types/node'/>
/// <reference path='../../../../src/vs/vscode.d.ts'/>

View File

@@ -2,7 +2,7 @@
# yarn lockfile v1
typescript@3.5.0-dev.20190517:
version "3.5.0-dev.20190517"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.0-dev.20190517.tgz#5a85f1091cf33fde39b04f898c5730e30edd3e39"
integrity sha512-KoBHq6ytEApXKTDtmTu4Sp/tC5SPe4FpvwutLEANhwdMPblqZdh7APuH7I/ceMlgfHSa7B00JgF7NokUJQi0/g==
typescript@3.4.5:
version "3.4.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99"
integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==

View File

@@ -25,8 +25,7 @@
"tslint": "node node_modules/tslint/bin/tslint -c tslint-gci.json -p src/tsconfig.json",
"strict-null-check": "tsc -p src/tsconfig.strictNullChecks.json",
"strict-null-check-watch": "tsc -p src/tsconfig.strictNullChecks.json --watch",
"strict-initialization-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictPropertyInitialization",
"web": "node scripts/code-web.js"
"strict-initialization-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictPropertyInitialization"
},
"dependencies": {
"@angular/animations": "~4.1.3",
@@ -76,7 +75,7 @@
"vscode-ripgrep": "^1.2.5",
"vscode-sqlite3": "4.0.7",
"vscode-textmate": "^4.0.1",
"vscode-xterm": "3.14.0-beta2",
"vscode-xterm": "3.13.0-beta3",
"yauzl": "^2.9.1",
"yazl": "^2.4.3",
"zone.js": "^0.8.4"
@@ -132,7 +131,6 @@
"gulp-uglify": "^3.0.0",
"gulp-untar": "^0.0.7",
"gulp-vinyl-zip": "^2.1.2",
"http-server": "^0.11.1",
"husky": "^0.13.1",
"innosetup-compiler": "^5.5.60",
"is": "^3.1.0",
@@ -145,7 +143,6 @@
"mkdirp": "^0.5.0",
"mocha": "^2.2.5",
"mocha-junit-reporter": "^1.17.0",
"opn": "^5.4.0",
"optimist": "0.3.5",
"p-all": "^1.0.0",
"pump": "^1.0.1",
@@ -158,7 +155,7 @@
"source-map": "^0.4.4",
"temp-write": "^3.4.0",
"ts-loader": "^4.4.2",
"tslint": "^5.16.0",
"tslint": "^5.11.0",
"tslint-microsoft-contrib": "^6.0.0",
"typemoq": "^0.3.2",
"typescript": "3.4.5",

View File

@@ -1,14 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const httpServer = require('http-server');
const opn = require('opn');
const url = 'http://127.0.0.1:8080/out/vs/code/browser/workbench/workbench.html';
httpServer.createServer({ root: '.', cache: 5 }).listen(8080);
console.log(`Open ${url} in your browser`);
opn(url);

View File

@@ -12,7 +12,7 @@ exports.base = [{
}];
exports.workbench = require('./vs/workbench/buildfile').collectModules(['vs/workbench/workbench.main']);
exports.workbenchWeb = require('./vs/workbench/buildfile').collectModules(['vs/workbench/workbench.web.main']);
exports.workbenchNodeless = require('./vs/workbench/buildfile').collectModules(['vs/workbench/workbench.nodeless.main']);
exports.code = require('./vs/code/buildfile').collectModules();

View File

@@ -14,7 +14,7 @@
background: url('check.svg') center center no-repeat;
}
.vs-dark .custom-checkbox.sql-checkbox.checked {
.vs-dark.monaco-shell .custom-checkbox.sql-checkbox.checked {
background: url('check_inverse.svg') center center no-repeat;
}

View File

@@ -7,8 +7,8 @@ import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import {
IActionBarOptions, ActionsOrientation, IActionViewItem,
IActionOptions, ActionViewItem, BaseActionViewItem
IActionBarOptions, ActionsOrientation, IActionItem,
IActionOptions, ActionItem, BaseActionItem
} from 'vs/base/browser/ui/actionbar/actionbar';
import * as lifecycle from 'vs/base/common/lifecycle';
import * as DOM from 'vs/base/browser/dom';
@@ -31,7 +31,7 @@ export class ActionBar extends ActionRunner implements IActionRunner {
private _context: any;
// Items
private _items: IActionViewItem[];
private _items: IActionItem[];
private _focusedItem?: number;
private _focusTracker: DOM.IFocusTracker;
@@ -214,14 +214,14 @@ export class ActionBar extends ActionRunner implements IActionRunner {
actionItemElement.className = 'action-item';
actionItemElement.setAttribute('role', 'presentation');
let item: IActionViewItem | undefined = undefined;
let item: IActionItem | undefined = undefined;
if (this._options.actionViewItemProvider) {
item = this._options.actionViewItemProvider(action);
if (this._options.actionItemProvider) {
item = this._options.actionItemProvider(action);
}
if (!item) {
item = new ActionViewItem(this.context, action, options);
item = new ActionItem(this.context, action, options);
}
item.actionRunner = this._actionRunner;
@@ -248,7 +248,7 @@ export class ActionBar extends ActionRunner implements IActionRunner {
public clear(): void {
// Do not dispose action items if they were provided from outside
this._items = this._options.actionViewItemProvider ? [] : lifecycle.dispose(this._items);
this._items = this._options.actionItemProvider ? [] : lifecycle.dispose(this._items);
DOM.clearNode(this._actionsList);
}
@@ -274,7 +274,7 @@ export class ActionBar extends ActionRunner implements IActionRunner {
}
let startIndex = this._focusedItem;
let item: IActionViewItem;
let item: IActionItem;
do {
this._focusedItem = (this._focusedItem + 1) % this._items.length;
@@ -294,7 +294,7 @@ export class ActionBar extends ActionRunner implements IActionRunner {
}
let startIndex = this._focusedItem;
let item: IActionViewItem;
let item: IActionItem;
do {
this._focusedItem = this._focusedItem - 1;
@@ -343,7 +343,7 @@ export class ActionBar extends ActionRunner implements IActionRunner {
// trigger action
let actionItem = this._items[this._focusedItem];
if (actionItem instanceof BaseActionViewItem) {
if (actionItem instanceof BaseActionItem) {
const context = (actionItem._context === null || actionItem._context === undefined) ? event : actionItem._context;
this.run(actionItem._action, context);
}

View File

@@ -43,8 +43,8 @@ export class Taskbar {
this.actionBar = new ActionBar(element, {
orientation: options.orientation,
ariaLabel: options.ariaLabel,
actionViewItemProvider: (action: Action) => {
return options.actionViewItemProvider ? options.actionViewItemProvider(action) : undefined;
actionItemProvider: (action: Action) => {
return options.actionItemProvider ? options.actionItemProvider(action) : undefined;
}
});
}

View File

@@ -397,7 +397,7 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
let isUntitled: boolean = uri.scheme === Schemas.untitled;
const fileInput = isUntitled ? this._untitledEditorService.createOrGet(uri, notebookModeId, options.initialContent) :
this._editorService.createInput({ resource: uri, mode: notebookModeId });
this._editorService.createInput({ resource: uri, language: notebookModeId });
let input = this._instantiationService.createInstance(NotebookInput, path.basename(uri.fsPath), uri, fileInput);
input.defaultKernel = options.defaultKernel;
input.connectionProfile = new ConnectionProfile(this._capabilitiesService, options.connectionProfile);

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.modal {
.monaco-shell .modal {
background-color: rgba(204, 204, 204, 0.6);
right: 0;
left: 0;
@@ -13,7 +13,7 @@
z-index: 500;
}
.modal:not(.flyout-dialog) .modal-dialog {
.monaco-shell .modal:not(.flyout-dialog) .modal-dialog {
margin: auto;
width: 640px;
height: 480px;
@@ -32,7 +32,7 @@
height: 25px;
}
.modal.flyout-dialog .modal-dialog {
.monaco-shell .modal.flyout-dialog .modal-dialog {
margin: auto auto auto auto;
height: 100%;
width: 500px;
@@ -40,13 +40,14 @@
position: absolute;
overflow-y: hidden;
}
.modal.flyout-dialog.wide .modal-dialog {
.monaco-shell .modal.flyout-dialog.wide .modal-dialog {
width: 1200px;
max-width: 95%;
min-width: 400px;
}
.modal.flyout-dialog .modal-content {
.monaco-shell .modal.flyout-dialog .modal-content {
height: 100%;
font-size: 11px;
display: flex;
@@ -65,10 +66,10 @@
margin-right: 10px;
}
.modal.flyout-dialog .modal-body,
.modal.flyout-dialog .angular-modal-body,
.monaco-shell .modal.flyout-dialog .modal-body,
.monaco-shell .modal.flyout-dialog .angular-modal-body,
/* Style for body and footer in modal dialog. This should be applied to dialog created with angular component. */
.modal.flyout-dialog .modal-body-and-footer {
.monaco-shell .modal.flyout-dialog .modal-body-and-footer {
flex: 1 1;
overflow: hidden;
}
@@ -104,11 +105,11 @@
padding-left: 4px;
}
.vs-dark .modal.flyout-dialog .input {
.vs-dark.monaco-shell .modal.flyout-dialog .input {
background-color: #3C3C3C;
}
.vs-dark .modal.flyout-dialog input:disabled {
.vs-dark.monaco-shell .modal.flyout-dialog input:disabled {
background-color: #E1E1E1;
color: #3C3C3C;
}

View File

@@ -10,6 +10,7 @@ import { IAction, ActionRunner, Action } from 'vs/base/common/actions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
import { ContextAwareMenuItemActionItem, fillInActionBarActions, fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { TreeItemCollapsibleState, ITreeViewDataProvider, TreeViewItemHandleArg, ViewContainer, ITreeItemLabel } from 'vs/workbench/common/views';
import { FileIconThemableWorkbenchTree } from 'vs/workbench/browser/parts/views/viewsViewlet';
@@ -21,7 +22,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import * as DOM from 'vs/base/browser/dom';
import { IDataSource, ITree, IRenderer, ContextMenuEvent } from 'vs/base/parts/tree/browser/tree';
import { ResourceLabel } from 'vs/workbench/browser/labels';
import { ActionBar, IActionViewItemProvider, ActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionBar, IActionItemProvider, ActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { URI } from 'vs/base/common/uri';
import { basename } from 'vs/base/common/path';
import { LIGHT, FileThemeIcon, FolderThemeIcon, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
@@ -45,7 +46,6 @@ import { ITreeItem, ITreeView } from 'sql/workbench/common/views';
import { IOEShimService } from 'sql/workbench/parts/objectExplorer/common/objectExplorerViewTreeShim';
import { equalsIgnoreCase } from 'vs/base/common/strings';
import { NodeContextKey } from 'sql/workbench/parts/dataExplorer/common/nodeContext';
import { fillInActionBarActions, fillInContextMenuActions, ContextAwareMenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
class TitleMenus implements IDisposable {
@@ -319,7 +319,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
}
private createTree() {
const actionItemProvider = (action: IAction) => action instanceof MenuItemAction ? this.instantiationService.createInstance(ContextAwareMenuEntryActionViewItem, action) : undefined;
const actionItemProvider = (action: IAction) => action instanceof MenuItemAction ? this.instantiationService.createInstance(ContextAwareMenuItemActionItem, action) : undefined;
const menus = this.instantiationService.createInstance(TreeMenus, this.id);
const dataSource = this.instantiationService.createInstance(TreeDataSource, this, this.container, this.id);
const renderer = this.instantiationService.createInstance(TreeRenderer, this.id, menus, actionItemProvider);
@@ -599,7 +599,7 @@ class TreeRenderer implements IRenderer {
constructor(
private treeViewId: string,
private menus: TreeMenus,
private actionItemProvider: IActionViewItemProvider,
private actionItemProvider: IActionItemProvider,
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkbenchThemeService private themeService: IWorkbenchThemeService,
@IConfigurationService private configurationService: IConfigurationService,
@@ -623,7 +623,7 @@ class TreeRenderer implements IRenderer {
DOM.addClass(resourceLabel.element.element, 'custom-view-tree-node-item-resourceLabel');
const actionsContainer = DOM.append(resourceLabel.element.element, DOM.$('.actions'));
const actionBar = new ActionBar(actionsContainer, {
actionViewItemProvider: this.actionItemProvider,
actionItemProvider: this.actionItemProvider,
actionRunner: new MultipleSelectionActionRunner(() => tree.getSelection())
});
@@ -769,10 +769,10 @@ class TreeController extends WorkbenchTreeController {
getActions: () => actions,
getActionViewItem: (action) => {
getActionItem: (action) => {
const keybinding = this._keybindingService.lookupKeybinding(action.id);
if (keybinding) {
return new ActionViewItem(action, action, { label: true, keybinding: keybinding.getLabel() });
return new ActionItem(action, action, { label: true, keybinding: keybinding.getLabel() });
}
return null;
},

View File

@@ -181,7 +181,7 @@ function getNotebookFileExtensions(instantiationService: IInstantiationService):
function hasNotebookFileMode(input: EditorInput): boolean {
if (input instanceof UntitledEditorInput) {
let untitledCast: UntitledEditorInput = <UntitledEditorInput>input;
return (untitledCast && untitledCast.getMode() === notebookModeId);
return (untitledCast && untitledCast.getModeId() === notebookModeId);
}
return false;
}
@@ -200,7 +200,7 @@ function withService<TService, TResult>(instantiationService: IInstantiationServ
function hasSqlFileMode(input: EditorInput): boolean {
if (input instanceof UntitledEditorInput) {
let untitledCast: UntitledEditorInput = <UntitledEditorInput>input;
return untitledCast && (untitledCast.getMode() === undefined || untitledCast.getMode() === sqlModeId);
return untitledCast && (untitledCast.getModeId() === undefined || untitledCast.getModeId() === sqlModeId);
}
return false;

View File

@@ -94,7 +94,7 @@ export default class WebViewComponent extends ComponentBase implements IComponen
private setHtml(): void {
if (this._webview && this.html) {
this._renderedHtml = this.html;
this._webview.html = this._renderedHtml;
this._webview.contents = this._renderedHtml;
this._webview.layout();
}
}

View File

@@ -80,7 +80,7 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
public setHtml(html: string): void {
this._html = html;
if (this._webview) {
this._webview.html = html;
this._webview.contents = html;
this._webview.layout();
}
}
@@ -112,7 +112,7 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
this._onMessage.fire(e);
});
if (this._html) {
this._webview.html = this._html;
this._webview.contents = this._html;
}
this._webview.layout();
}

View File

@@ -60,7 +60,7 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
public setHtml(html: string): void {
this._html = html;
if (this._webview) {
this._webview.html = html;
this._webview.contents = html;
this._webview.layout();
}
}
@@ -110,7 +110,7 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
this._onMessage.fire(e);
});
if (this._html) {
this._webview.html = this._html;
this._webview.contents = this._html;
}
this._webview.layout();
}

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Action, IActionViewItem, IActionRunner } from 'vs/base/common/actions';
import { Action, IActionItem, IActionRunner } from 'vs/base/common/actions';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IQueryModelService } from 'sql/platform/query/common/queryModel';
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
@@ -150,7 +150,7 @@ export class ChangeMaxRowsAction extends EditDataAction {
* Action item that handles the dropdown (combobox) that lists the avaliable number of row selections
* for an edit data session
*/
export class ChangeMaxRowsActionItem implements IActionViewItem {
export class ChangeMaxRowsActionItem implements IActionItem {
public actionRunner: IActionRunner;
public defaultRowCount: number;

View File

@@ -19,7 +19,7 @@ import { EditDataInput } from 'sql/workbench/parts/editData/common/editDataInput
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import * as queryContext from 'sql/workbench/parts/query/common/queryContext';
import { Taskbar, ITaskbarContent } from 'sql/base/browser/ui/taskbar/taskbar';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { Action } from 'vs/base/common/actions';
import { IQueryModelService } from 'sql/platform/query/common/queryModel';
import { IEditorDescriptorService } from 'sql/workbench/services/queryEditor/common/editorDescriptorService';
@@ -313,7 +313,7 @@ export class EditDataEditor extends BaseEditor {
// Create QueryTaskbar
this._taskbarContainer = DOM.append(parentElement, DOM.$('div'));
this._taskbar = new Taskbar(this._taskbarContainer, {
actionViewItemProvider: (action: Action) => this._getChangeMaxRowsAction(action)
actionItemProvider: (action: Action) => this._getChangeMaxRowsAction(action)
});
// Create Actions for the toolbar
@@ -344,7 +344,7 @@ export class EditDataEditor extends BaseEditor {
/**
* Gets the IActionItem for the list of row number drop down
*/
private _getChangeMaxRowsAction(action: Action): IActionViewItem {
private _getChangeMaxRowsAction(action: Action): IActionItem {
let actionID = ChangeMaxRowsAction.ID;
if (action.id === actionID) {
if (!this._changeMaxRowsActionItem) {

View File

@@ -119,8 +119,8 @@ input#accordion:checked ~ .accordion-content {
padding-bottom: 10px;
}
.vs-dark .all-jobs >.back-button-icon,
.hc-black .all-jobs >.back-button-icon {
.vs-dark.monaco-shell .all-jobs >.back-button-icon,
.hc-black.monaco-shell .all-jobs >.back-button-icon {
content: url('back_inverse.svg');
}

View File

@@ -14,9 +14,10 @@ import { IContextMenuService, IContextViewService } from 'vs/platform/contextvie
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { MenuId, IMenuService, MenuItemAction } from 'vs/platform/actions/common/actions';
import { IAction, Action, IActionViewItem } from 'vs/base/common/actions';
import { IAction, Action, IActionItem } from 'vs/base/common/actions';
import { IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { fillInActions, LabeledMenuItemActionItem } from 'vs/platform/actions/browser/menuItemActionItem';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { AngularDisposable } from 'sql/base/node/lifecycle';
@@ -47,7 +48,6 @@ import { createErrorWithActions } from 'vs/base/common/errorsWithActions';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { ILogService } from 'vs/platform/log/common/log';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { LabeledMenuItemActionItem, fillInActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
export const NOTEBOOK_SELECTOR: string = 'notebook-component';
@@ -405,7 +405,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
this._trustedAction.enabled = false;
let taskbar = <HTMLElement>this.toolbar.nativeElement;
this._actionBar = new Taskbar(taskbar, { actionViewItemProvider: action => this.actionItemProvider(action as Action) });
this._actionBar = new Taskbar(taskbar, { actionItemProvider: action => this.actionItemProvider(action as Action) });
this._actionBar.context = this;
this._actionBar.setContent([
{ action: addCodeCellButton },
@@ -419,7 +419,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
}
private actionItemProvider(action: Action): IActionViewItem {
private actionItemProvider(action: Action): IActionItem {
// Check extensions to create ActionItem; otherwise, return undefined
// This is similar behavior that exists in MenuItemActionItem
if (action instanceof MenuItemAction) {

View File

@@ -8,6 +8,7 @@ import { ContributableActionProvider } from 'vs/workbench/browser/actions';
import { IAction } from 'vs/base/common/actions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { fillInActions } from 'vs/platform/actions/browser/menuItemActionItem';
import {
DisconnectConnectionAction, AddServerAction,
@@ -30,7 +31,6 @@ import { TreeNodeContextKey } from 'sql/workbench/parts/objectExplorer/common/tr
import { IQueryManagementService } from 'sql/platform/query/common/queryManagement';
import { IScriptingService } from 'sql/platform/scripting/common/scriptingService';
import { ServerInfoContextKey } from 'sql/workbench/parts/connection/common/serverInfoContextKey';
import { fillInActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
/**
* Provides actions for the server tree elements

View File

@@ -5,7 +5,7 @@
import 'vs/css!./media/queryActions';
import * as nls from 'vs/nls';
import { Action, IActionViewItem, IActionRunner } from 'vs/base/common/actions';
import { Action, IActionItem, IActionRunner } from 'vs/base/common/actions';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -427,7 +427,7 @@ export class ListDatabasesAction extends QueryTaskbarAction {
* Action item that handles the dropdown (combobox) that lists the available databases.
* Based off StartDebugActionItem.
*/
export class ListDatabasesActionItem implements IActionViewItem {
export class ListDatabasesActionItem implements IActionItem {
public static ID = 'listDatabaseQueryActionItem';
public actionRunner: IActionRunner;

View File

@@ -23,7 +23,7 @@ import { TextResourceEditor } from 'vs/workbench/browser/parts/editor/textResour
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { Action } from 'vs/base/common/actions';
import { ISelectionData } from 'azdata';
import { IDisposable } from 'vs/base/common/lifecycle';
@@ -463,7 +463,7 @@ export class QueryEditor extends BaseEditor {
// Create QueryTaskbar
this._taskbarContainer = DOM.append(parentElement, DOM.$('div'));
this._taskbar = new Taskbar(this._taskbarContainer, {
actionViewItemProvider: (action: Action) => this._getActionItemForAction(action),
actionItemProvider: (action: Action) => this._getActionItemForAction(action),
});
// Create Actions for the toolbar
@@ -513,7 +513,7 @@ export class QueryEditor extends BaseEditor {
* Gets the IActionItem for the List Databases dropdown if provided the associated Action.
* Otherwise returns null.
*/
private _getActionItemForAction(action: Action): IActionViewItem {
private _getActionItemForAction(action: Action): IActionItem {
if (action.id === ListDatabasesAction.ID) {
return this.listDatabasesActionItem;
}

View File

@@ -146,11 +146,8 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
// Description is shown beside the tab name in the combobox of open editors
public getDescription(): string { return this._description; }
public supportsSplitEditor(): boolean { return false; }
public getMode(): string { return QueryInput.SCHEMA; }
public getModeId(): string { return QueryInput.SCHEMA; }
public revert(): Promise<boolean> { return this._sql.revert(); }
public setMode(mode: string) {
this._sql.setMode(mode);
}
public matches(otherInput: any): boolean {
if (otherInput instanceof QueryInput) {

View File

@@ -121,7 +121,7 @@ export class WebViewDialog extends Modal {
}
private updateDialogBody(): void {
this._webview.html = this.html;
this._webview.contents = this.html;
}
/* espace key */

View File

@@ -303,7 +303,7 @@ export class QueryEditorService implements IQueryEditorService {
newEditorInput = queryInput;
} else {
let uriCopy: URI = URI.from({ scheme: uri.scheme, authority: uri.authority, path: uri.path, query: uri.query, fragment: uri.fragment });
newEditorInput = QueryEditorService.instantiationService.createInstance(FileEditorInput, uriCopy, undefined, undefined);
newEditorInput = QueryEditorService.instantiationService.createInstance(FileEditorInput, uriCopy, undefined);
}
return newEditorInput;

View File

@@ -101,6 +101,17 @@ declare module 'vscode-xterm' {
*/
experimentalCharAtlas?: 'none' | 'static' | 'dynamic';
/**
* (EXPERIMENTAL) Defines which implementation to use for buffer lines.
*
* - 'JsArray': The default/stable implementation.
* - 'TypedArray': The new experimental implementation based on TypedArrays that is expected to
* significantly boost performance and memory consumption. Use at your own risk.
*
* @deprecated This option will be removed in the future.
*/
experimentalBufferLineImpl?: 'JsArray' | 'TypedArray';
/**
* The font size used to render text.
*/
@@ -188,18 +199,6 @@ declare module 'vscode-xterm' {
* The color theme of the terminal.
*/
theme?: ITheme;
/**
* Whether "Windows mode" is enabled. Because Windows backends winpty and
* conpty operate by doing line wrapping on their side, xterm.js does not
* have access to wrapped lines. When Windows mode is enabled the following
* changes will be in effect:
*
* - Reflow is disabled.
* - Lines are assumed to be wrapped if the last character of the line is
* not whitespace.
*/
windowsMode?: boolean;
}
/**
@@ -275,7 +274,7 @@ declare module 'vscode-xterm' {
* A callback that fires when the mouse leaves a link. Note that this can
* happen even when tooltipCallback hasn't fired for the link yet.
*/
leaveCallback?: () => void;
leaveCallback?: (event: MouseEvent, uri: string) => boolean | void;
/**
* The priority of the link matcher, this defines the order in which the link
@@ -307,14 +306,6 @@ declare module 'vscode-xterm' {
dispose(): void;
}
/**
* An event that can be listened to.
* @returns an `IDisposable` to stop listening.
*/
export interface IEvent<T> {
(listener: (e: T) => any): IDisposable;
}
export interface IMarker extends IDisposable {
readonly id: number;
readonly isDisposed: boolean;
@@ -334,39 +325,28 @@ declare module 'vscode-xterm' {
/**
* The element containing the terminal.
*/
readonly element: HTMLElement;
element: HTMLElement;
/**
* The textarea that accepts input for the terminal.
*/
readonly textarea: HTMLTextAreaElement;
textarea: HTMLTextAreaElement;
/**
* The number of rows in the terminal's viewport. Use
* `ITerminalOptions.rows` to set this in the constructor and
* `Terminal.resize` for when the terminal exists.
* The number of rows in the terminal's viewport.
*/
readonly rows: number;
rows: number;
/**
* The number of columns in the terminal's viewport. Use
* `ITerminalOptions.cols` to set this in the constructor and
* `Terminal.resize` for when the terminal exists.
* The number of columns in the terminal's viewport.
*/
readonly cols: number;
/**
* (EXPERIMENTAL) The terminal's current buffer, this might be either the
* normal buffer or the alt buffer depending on what's running in the
* terminal.
*/
readonly buffer: IBuffer;
cols: number;
/**
* (EXPERIMENTAL) Get all markers registered against the buffer. If the alt
* buffer is active this will always return [].
*/
readonly markers: ReadonlyArray<IMarker>;
markers: IMarker[];
/**
* Natural language strings that can be localized.
@@ -380,70 +360,6 @@ declare module 'vscode-xterm' {
*/
constructor(options?: ITerminalOptions);
/**
* Adds an event listener for the cursor moves.
* @returns an `IDisposable` to stop listening.
*/
onCursorMove: IEvent<void>;
/**
* Adds an event listener for when a data event fires. This happens for
* example when the user types or pastes into the terminal. The event value
* is whatever `string` results, in a typical setup, this should be passed
* on to the backing pty.
* @returns an `IDisposable` to stop listening.
*/
onData: IEvent<string>;
/**
* Adds an event listener for a key is pressed. The event value contains the
* string that will be sent in the data event as well as the DOM event that
* triggered it.
* @returns an `IDisposable` to stop listening.
*/
onKey: IEvent<{ key: string, domEvent: KeyboardEvent }>;
/**
* Adds an event listener for when a line feed is added.
* @returns an `IDisposable` to stop listening.
*/
onLineFeed: IEvent<void>;
/**
* Adds an event listener for when a scroll occurs. The event value is the
* new position of the viewport.
* @returns an `IDisposable` to stop listening.
*/
onScroll: IEvent<number>;
/**
* Adds an event listener for when a selection change occurs.
* @returns an `IDisposable` to stop listening.
*/
onSelectionChange: IEvent<void>;
/**
* Adds an event listener for when rows are rendered. The event value
* contains the start row and end rows of the rendered area (ranges from `0`
* to `Terminal.rows - 1`).
* @returns an `IDisposable` to stop listening.
*/
onRender: IEvent<{ start: number, end: number }>;
/**
* Adds an event listener for when the terminal is resized. The event value
* contains the new size.
* @returns an `IDisposable` to stop listening.
*/
onResize: IEvent<{ cols: number, rows: number }>;
/**
* Adds an event listener for when an OSC 0 or OSC 2 title change occurs.
* The event value is the new title.
* @returns an `IDisposable` to stop listening.
*/
onTitleChange: IEvent<string>;
/**
* Unfocus the terminal.
*/
@@ -458,63 +374,54 @@ declare module 'vscode-xterm' {
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'blur' | 'focus' | 'linefeed' | 'selection', listener: () => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'data', listener: (...args: any[]) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'key', listener: (key: string, event: KeyboardEvent) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'keypress' | 'keydown', listener: (event: KeyboardEvent) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'refresh', listener: (data: { start: number, end: number }) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'resize', listener: (data: { cols: number, rows: number }) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'scroll', listener: (ydisp: number) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'title', listener: (title: string) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: string, listener: (...args: any[]) => void): void;
@@ -522,7 +429,6 @@ declare module 'vscode-xterm' {
* Deregisters an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener).dispose()` instead.
*/
off(type: 'blur' | 'focus' | 'linefeed' | 'selection' | 'data' | 'key' | 'keypress' | 'keydown' | 'refresh' | 'resize' | 'scroll' | 'title' | string, listener: (...args: any[]) => void): void;
@@ -540,19 +446,22 @@ declare module 'vscode-xterm' {
* be used to conveniently remove the event listener.
* @param type The type of event.
* @param handler The event handler.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
addDisposableListener(type: string, handler: (...args: any[]) => void): IDisposable;
/**
* Resizes the terminal. It's best practice to debounce calls to resize,
* this will help ensure that the pty can respond to the resize event
* before another one occurs.
* Resizes the terminal.
* @param x The number of columns to resize to.
* @param y The number of rows to resize to.
*/
resize(columns: number, rows: number): void;
/**
* Writes text to the terminal, followed by a break line character (\n).
* @param data The text to write to the terminal.
*/
writeln(data: string): void;
/**
* Opens the terminal within an element.
* @param parent The element to create the terminal within. This element
@@ -567,35 +476,11 @@ declare module 'vscode-xterm' {
* should be processed by the terminal and what keys should not.
* @param customKeyEventHandler The custom KeyboardEvent handler to attach.
* This is a function that takes a KeyboardEvent, allowing consumers to stop
* propagation and/or prevent the default action. The function returns
* propogation and/or prevent the default action. The function returns
* whether the event should be processed by xterm.js.
*/
attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void;
/**
* (EXPERIMENTAL) Adds a handler for CSI escape sequences.
* @param flag The flag should be one-character string, which specifies the
* final character (e.g "m" for SGR) of the CSI sequence.
* @param callback The function to handle the escape sequence. The callback
* is called with the numerical params, as well as the special characters
* (e.g. "$" for DECSCPP). Return true if the sequence was handled; false if
* we should try a previous handler (set by addCsiHandler or setCsiHandler).
* The most recently-added handler is tried first.
* @return An IDisposable you can call to remove this handler.
*/
addCsiHandler(flag: string, callback: (params: number[], collect: string) => boolean): IDisposable;
/**
* (EXPERIMENTAL) Adds a handler for OSC escape sequences.
* @param ident The number (first parameter) of the sequence.
* @param callback The function to handle the escape sequence. The callback
* is called with OSC data string. Return true if the sequence was handled;
* false if we should try a previous handler (set by addOscHandler or
* setOscHandler). The most recently-added handler is tried first.
* @return An IDisposable you can call to remove this handler.
*/
addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable;
/**
* (EXPERIMENTAL) Registers a link matcher, allowing custom link patterns to
* be matched and handled.
@@ -670,24 +555,11 @@ declare module 'vscode-xterm' {
*/
getSelection(): string;
/**
* Gets the selection position or undefined if there is no selection.
*/
getSelectionPosition(): ISelectionPosition | undefined;
/**
* Clears the current terminal selection.
*/
clearSelection(): void;
/**
* Selects text within the terminal.
* @param column The column the selection starts at..
* @param row The row the selection starts at.
* @param length The length of the selection.
*/
select(column: number, row: number, length: number): void;
/**
* Selects all text within the terminal.
*/
@@ -752,20 +624,6 @@ declare module 'vscode-xterm' {
*/
write(data: string): void;
/**
* Writes text to the terminal, followed by a break line character (\n).
* @param data The text to write to the terminal.
*/
writeln(data: string): void;
/**
* Writes UTF8 data to the terminal.
* This has a slight performance advantage over the string based write method
* due to lesser data conversions needed on the way from the pty to xterm.js.
* @param data The data to write to the terminal.
*/
writeUtf8(data: Uint8Array): void;
/**
* Retrieves an option's value from the terminal.
* @param key The option key.
@@ -775,7 +633,7 @@ declare module 'vscode-xterm' {
* Retrieves an option's value from the terminal.
* @param key The option key.
*/
getOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'rightClickSelectsWord' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell' | 'windowsMode'): boolean;
getOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'rightClickSelectsWord' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell'): boolean;
/**
* Retrieves an option's value from the terminal.
* @param key The option key.
@@ -826,7 +684,7 @@ declare module 'vscode-xterm' {
* @param key The option key.
* @param value The option value.
*/
setOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'popOnBell' | 'rightClickSelectsWord' | 'screenKeys' | 'useFlowControl' | 'visualBell' | 'windowsMode', value: boolean): void;
setOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'popOnBell' | 'rightClickSelectsWord' | 'screenKeys' | 'useFlowControl' | 'visualBell', value: boolean): void;
/**
* Sets an option on the terminal.
* @param key The option key.
@@ -881,134 +739,8 @@ declare module 'vscode-xterm' {
* Applies an addon to the Terminal prototype, making it available to all
* newly created Terminals.
* @param addon The addon to apply.
* @deprecated Use the new loadAddon API/addon format.
*/
static applyAddon(addon: any): void;
/**
* (EXPERIMENTAL) Loads an addon into this instance of xterm.js.
* @param addon The addon to load.
*/
loadAddon(addon: ITerminalAddon): void;
}
/**
* An addon that can provide additional functionality to the terminal.
*/
export interface ITerminalAddon extends IDisposable {
/**
* (EXPERIMENTAL) This is called when the addon is activated within xterm.js.
*/
activate(terminal: Terminal): void;
}
/**
* An object representing a selecrtion within the terminal.
*/
interface ISelectionPosition {
/**
* The start column of the selection.
*/
startColumn: number;
/**
* The start row of the selection.
*/
startRow: number;
/**
* The end column of the selection.
*/
endColumn: number;
/**
* The end row of the selection.
*/
endRow: number;
}
interface IBuffer {
/**
* The y position of the cursor. This ranges between `0` (when the
* cursor is at baseY) and `Terminal.rows - 1` (when the cursor is on the
* last row).
*/
readonly cursorY: number;
/**
* The x position of the cursor. This ranges between `0` (left side) and
* `Terminal.cols - 1` (right side).
*/
readonly cursorX: number;
/**
* The line within the buffer where the top of the viewport is.
*/
readonly viewportY: number;
/**
* The line within the buffer where the top of the bottom page is (when
* fully scrolled down);
*/
readonly baseY: number;
/**
* The amount of lines in the buffer.
*/
readonly length: number;
/**
* Gets a line from the buffer, or undefined if the line index does not exist.
*
* Note that the result of this function should be used immediately after calling as when the
* terminal updates it could lead to unexpected behavior.
*
* @param y The line index to get.
*/
getLine(y: number): IBufferLine | undefined;
}
interface IBufferLine {
/**
* Whether the line is wrapped from the previous line.
*/
readonly isWrapped: boolean;
/**
* Gets a cell from the line, or undefined if the line index does not exist.
*
* Note that the result of this function should be used immediately after calling as when the
* terminal updates it could lead to unexpected behavior.
*
* @param x The character index to get.
*/
getCell(x: number): IBufferCell;
/**
* Gets the line as a string. Note that this is gets only the string for the line, not taking
* isWrapped into account.
*
* @param trimRight Whether to trim any whitespace at the right of the line.
* @param startColumn The column to start from (inclusive).
* @param endColumn The column to end at (exclusive).
*/
translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string;
}
interface IBufferCell {
/**
* The character within the cell.
*/
readonly char: string;
/**
* The width of the character. Some examples:
*
* - This is `1` for most cells.
* - This is `2` for wide character like CJK glyphs.
* - This is `0` for cells immediately following cells with a width of `2`.
*/
readonly width: number;
}
}
@@ -1018,10 +750,22 @@ declare module 'vscode-xterm' {
interface TerminalCore {
debug: boolean;
buffer: {
y: number;
ybase: number;
ydisp: number;
x: number;
lines: any[];
translateBufferLineToString(lineIndex: number, trimRight: boolean): string;
};
handler(text: string): void;
_onScroll: IEventEmitter2<number>;
_onKey: IEventEmitter2<{ key: string }>;
/**
* Emit an event on the terminal.
*/
emit(type: string, data: any): void;
charMeasure?: { height: number, width: number };
@@ -1031,10 +775,6 @@ declare module 'vscode-xterm' {
};
}
interface IEventEmitter2<T> {
fire(e: T): void;
}
interface ISearchOptions {
/**
* Whether the find should be done as a regex.
@@ -1054,6 +794,7 @@ declare module 'vscode-xterm' {
_core: TerminalCore;
webLinksInit(handler?: (event: MouseEvent, uri: string) => void, options?: ILinkMatcherOptions): void;
winptyCompatInit(): void;
/**
* Find the next instance of the term, then scroll to and select it. If it

View File

@@ -45,13 +45,13 @@ class WindowManager {
// --- Pixel Ratio
public getPixelRatio(): number {
let ctx: any = document.createElement('canvas').getContext('2d');
let ctx = document.createElement('canvas').getContext('2d');
let dpr = window.devicePixelRatio || 1;
let bsr = ctx.webkitBackingStorePixelRatio ||
ctx.mozBackingStorePixelRatio ||
ctx.msBackingStorePixelRatio ||
ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1;
let bsr = (<any>ctx).webkitBackingStorePixelRatio ||
(<any>ctx).mozBackingStorePixelRatio ||
(<any>ctx).msBackingStorePixelRatio ||
(<any>ctx).oBackingStorePixelRatio ||
(<any>ctx).backingStorePixelRatio || 1;
return dpr / bsr;
}

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { IAction, IActionRunner } from 'vs/base/common/actions';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { SubmenuAction } from 'vs/base/browser/ui/menu/menu';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
@@ -25,7 +25,7 @@ export class ContextSubMenu extends SubmenuAction {
export interface IContextMenuDelegate {
getAnchor(): HTMLElement | { x: number; y: number; width?: number; height?: number; };
getActions(): Array<IAction | ContextSubMenu>;
getActionViewItem?(action: IAction): IActionViewItem | undefined;
getActionItem?(action: IAction): IActionItem | undefined;
getActionsContext?(event?: IContextMenuEvent): any;
getKeyBinding?(action: IAction): ResolvedKeybinding | undefined;
getMenuClassName?(): string;

View File

@@ -329,7 +329,7 @@ function parseFormattedText(content: string): IFormatParseTree {
children: []
};
let actionViewItemIndex = 0;
let actionItemIndex = 0;
let current = root;
const stack: IFormatParseTree[] = [];
const stream = new StringStream(content);
@@ -359,8 +359,8 @@ function parseFormattedText(content: string): IFormatParseTree {
};
if (type === FormatType.Action) {
newCurrent.index = actionViewItemIndex;
actionViewItemIndex++;
newCurrent.index = actionItemIndex;
actionItemIndex++;
}
current.children!.push(newCurrent);

View File

@@ -18,7 +18,7 @@ import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview
import { Event, Emitter } from 'vs/base/common/event';
import { asArray } from 'vs/base/common/arrays';
export interface IActionViewItem {
export interface IActionItem {
actionRunner: IActionRunner;
setActionContext(context: any): void;
render(element: HTMLElement): void;
@@ -28,12 +28,12 @@ export interface IActionViewItem {
dispose(): void;
}
export interface IBaseActionViewItemOptions {
export interface IBaseActionItemOptions {
draggable?: boolean;
isMenu?: boolean;
}
export class BaseActionViewItem extends Disposable implements IActionViewItem {
export class BaseActionItem extends Disposable implements IActionItem {
element?: HTMLElement;
_context: any;
@@ -41,7 +41,7 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
private _actionRunner: IActionRunner;
constructor(context: any, action: IAction, protected options?: IBaseActionViewItemOptions) {
constructor(context: any, action: IAction, protected options?: IBaseActionItemOptions) {
super();
this._context = context || this;
@@ -226,20 +226,20 @@ export class Separator extends Action {
}
}
export interface IActionViewItemOptions extends IBaseActionViewItemOptions {
export interface IActionItemOptions extends IBaseActionItemOptions {
icon?: boolean;
label?: boolean;
keybinding?: string | null;
}
export class ActionViewItem extends BaseActionViewItem {
export class ActionItem extends BaseActionItem {
protected label: HTMLElement;
protected options: IActionViewItemOptions;
protected options: IActionItemOptions;
private cssClass?: string;
constructor(context: any, action: IAction, options: IActionViewItemOptions = {}) {
constructor(context: any, action: IAction, options: IActionItemOptions = {}) {
super(context, action, options);
this.options = options;
@@ -363,14 +363,14 @@ export interface ActionTrigger {
keyDown: boolean;
}
export interface IActionViewItemProvider {
(action: IAction): IActionViewItem | undefined;
export interface IActionItemProvider {
(action: IAction): IActionItem | undefined;
}
export interface IActionBarOptions {
orientation?: ActionsOrientation;
context?: any;
actionViewItemProvider?: IActionViewItemProvider;
actionItemProvider?: IActionItemProvider;
actionRunner?: IActionRunner;
ariaLabel?: string;
animated?: boolean;
@@ -386,7 +386,7 @@ const defaultOptions: IActionBarOptions = {
}
};
export interface IActionOptions extends IActionViewItemOptions {
export interface IActionOptions extends IActionItemOptions {
index?: number;
}
@@ -397,8 +397,8 @@ export class ActionBar extends Disposable implements IActionRunner {
private _actionRunner: IActionRunner;
private _context: any;
// View Items
viewItems: IActionViewItem[];
// Items
items: IActionItem[];
protected focusedItem?: number;
private focusTracker: DOM.IFocusTracker;
@@ -438,7 +438,7 @@ export class ActionBar extends Disposable implements IActionRunner {
this._register(this._actionRunner.onDidRun(e => this._onDidRun.fire(e)));
this._register(this._actionRunner.onDidBeforeRun(e => this._onDidBeforeRun.fire(e)));
this.viewItems = [];
this.items = [];
this.focusedItem = undefined;
this.domNode = document.createElement('div');
@@ -575,7 +575,7 @@ export class ActionBar extends Disposable implements IActionRunner {
set context(context: any) {
this._context = context;
this.viewItems.forEach(i => i.setActionContext(context));
this.items.forEach(i => i.setActionContext(context));
}
get actionRunner(): IActionRunner {
@@ -585,7 +585,7 @@ export class ActionBar extends Disposable implements IActionRunner {
set actionRunner(actionRunner: IActionRunner) {
if (actionRunner) {
this._actionRunner = actionRunner;
this.viewItems.forEach(item => item.actionRunner = actionRunner);
this.items.forEach(item => item.actionRunner = actionRunner);
}
}
@@ -599,36 +599,36 @@ export class ActionBar extends Disposable implements IActionRunner {
let index = types.isNumber(options.index) ? options.index : null;
actions.forEach((action: IAction) => {
const actionViewItemElement = document.createElement('li');
actionViewItemElement.className = 'action-item';
actionViewItemElement.setAttribute('role', 'presentation');
const actionItemElement = document.createElement('li');
actionItemElement.className = 'action-item';
actionItemElement.setAttribute('role', 'presentation');
// Prevent native context menu on actions
this._register(DOM.addDisposableListener(actionViewItemElement, DOM.EventType.CONTEXT_MENU, (e: DOM.EventLike) => {
this._register(DOM.addDisposableListener(actionItemElement, DOM.EventType.CONTEXT_MENU, (e: DOM.EventLike) => {
e.preventDefault();
e.stopPropagation();
}));
let item: IActionViewItem | undefined;
let item: IActionItem | undefined;
if (this.options.actionViewItemProvider) {
item = this.options.actionViewItemProvider(action);
if (this.options.actionItemProvider) {
item = this.options.actionItemProvider(action);
}
if (!item) {
item = new ActionViewItem(this.context, action, options);
item = new ActionItem(this.context, action, options);
}
item.actionRunner = this._actionRunner;
item.setActionContext(this.context);
item.render(actionViewItemElement);
item.render(actionItemElement);
if (index === null || index < 0 || index >= this.actionsList.children.length) {
this.actionsList.appendChild(actionViewItemElement);
this.viewItems.push(item);
this.actionsList.appendChild(actionItemElement);
this.items.push(item);
} else {
this.actionsList.insertBefore(actionViewItemElement, this.actionsList.children[index]);
this.viewItems.splice(index, 0, item);
this.actionsList.insertBefore(actionItemElement, this.actionsList.children[index]);
this.items.splice(index, 0, item);
index++;
}
});
@@ -657,23 +657,23 @@ export class ActionBar extends Disposable implements IActionRunner {
}
pull(index: number): void {
if (index >= 0 && index < this.viewItems.length) {
if (index >= 0 && index < this.items.length) {
this.actionsList.removeChild(this.actionsList.childNodes[index]);
dispose(this.viewItems.splice(index, 1));
dispose(this.items.splice(index, 1));
}
}
clear(): void {
this.viewItems = dispose(this.viewItems);
this.items = dispose(this.items);
DOM.clearNode(this.actionsList);
}
length(): number {
return this.viewItems.length;
return this.items.length;
}
isEmpty(): boolean {
return this.viewItems.length === 0;
return this.items.length === 0;
}
focus(index?: number): void;
@@ -691,7 +691,7 @@ export class ActionBar extends Disposable implements IActionRunner {
if (selectFirst && typeof this.focusedItem === 'undefined') {
// Focus the first enabled item
this.focusedItem = this.viewItems.length - 1;
this.focusedItem = this.items.length - 1;
this.focusNext();
} else {
if (index !== undefined) {
@@ -704,15 +704,15 @@ export class ActionBar extends Disposable implements IActionRunner {
protected focusNext(): void {
if (typeof this.focusedItem === 'undefined') {
this.focusedItem = this.viewItems.length - 1;
this.focusedItem = this.items.length - 1;
}
const startIndex = this.focusedItem;
let item: IActionViewItem;
let item: IActionItem;
do {
this.focusedItem = (this.focusedItem + 1) % this.viewItems.length;
item = this.viewItems[this.focusedItem];
this.focusedItem = (this.focusedItem + 1) % this.items.length;
item = this.items[this.focusedItem];
} while (this.focusedItem !== startIndex && !item.isEnabled());
if (this.focusedItem === startIndex && !item.isEnabled()) {
@@ -728,16 +728,16 @@ export class ActionBar extends Disposable implements IActionRunner {
}
const startIndex = this.focusedItem;
let item: IActionViewItem;
let item: IActionItem;
do {
this.focusedItem = this.focusedItem - 1;
if (this.focusedItem < 0) {
this.focusedItem = this.viewItems.length - 1;
this.focusedItem = this.items.length - 1;
}
item = this.viewItems[this.focusedItem];
item = this.items[this.focusedItem];
} while (this.focusedItem !== startIndex && !item.isEnabled());
if (this.focusedItem === startIndex && !item.isEnabled()) {
@@ -752,21 +752,21 @@ export class ActionBar extends Disposable implements IActionRunner {
this.actionsList.focus();
}
for (let i = 0; i < this.viewItems.length; i++) {
const item = this.viewItems[i];
const actionViewItem = item;
for (let i = 0; i < this.items.length; i++) {
const item = this.items[i];
const actionItem = item;
if (i === this.focusedItem) {
if (types.isFunction(actionViewItem.isEnabled)) {
if (actionViewItem.isEnabled() && types.isFunction(actionViewItem.focus)) {
actionViewItem.focus(fromRight);
if (types.isFunction(actionItem.isEnabled)) {
if (actionItem.isEnabled() && types.isFunction(actionItem.focus)) {
actionItem.focus(fromRight);
} else {
this.actionsList.focus();
}
}
} else {
if (types.isFunction(actionViewItem.blur)) {
actionViewItem.blur();
if (types.isFunction(actionItem.blur)) {
actionItem.blur();
}
}
}
@@ -778,16 +778,16 @@ export class ActionBar extends Disposable implements IActionRunner {
}
// trigger action
const actionViewItem = this.viewItems[this.focusedItem];
if (actionViewItem instanceof BaseActionViewItem) {
const context = (actionViewItem._context === null || actionViewItem._context === undefined) ? event : actionViewItem._context;
this.run(actionViewItem._action, context);
const actionItem = this.items[this.focusedItem];
if (actionItem instanceof BaseActionItem) {
const context = (actionItem._context === null || actionItem._context === undefined) ? event : actionItem._context;
this.run(actionItem._action, context);
}
}
private cancel(): void {
if (document.activeElement instanceof HTMLElement) {
document.activeElement.blur(); // remove focus from focused action
(<HTMLElement>document.activeElement).blur(); // remove focus from focused action
}
this._onDidCancel.fire();
@@ -798,8 +798,8 @@ export class ActionBar extends Disposable implements IActionRunner {
}
dispose(): void {
dispose(this.viewItems);
this.viewItems = [];
dispose(this.items);
this.items = [];
DOM.removeNode(this.getContainer());
@@ -807,7 +807,7 @@ export class ActionBar extends Disposable implements IActionRunner {
}
}
export class SelectActionViewItem extends BaseActionViewItem {
export class SelectActionItem extends BaseActionItem {
protected selectBox: SelectBox;
constructor(ctx: any, action: IAction, options: ISelectOptionItem[], selected: number, contextViewProvider: IContextViewProvider, selectBoxOptions?: ISelectBoxOptions) {

View File

@@ -11,7 +11,7 @@ import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { KeyCode } from 'vs/base/common/keyCodes';
import * as objects from 'vs/base/common/objects';
import { BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { BaseActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
export interface ICheckboxOpts extends ICheckboxStyles {
@@ -28,7 +28,7 @@ const defaultOpts = {
inputActiveOptionBorder: Color.fromHex('#007ACC')
};
export class CheckboxActionViewItem extends BaseActionViewItem {
export class CheckboxActionItem extends BaseActionItem {
private checkbox: Checkbox;
private disposables: IDisposable[] = [];

View File

@@ -132,13 +132,13 @@ export class ContextView extends Disposable {
ContextView.BUBBLE_UP_EVENTS.forEach(event => {
toDisposeOnSetContainer.push(DOM.addStandardDisposableListener(this.container!, event, (e: Event) => {
this.onDOMEvent(e, false);
this.onDOMEvent(e, <HTMLElement>document.activeElement, false);
}));
});
ContextView.BUBBLE_DOWN_EVENTS.forEach(event => {
toDisposeOnSetContainer.push(DOM.addStandardDisposableListener(this.container!, event, (e: Event) => {
this.onDOMEvent(e, true);
this.onDOMEvent(e, <HTMLElement>document.activeElement, true);
}, true));
});
@@ -213,11 +213,13 @@ export class ContextView extends Disposable {
height: elementPosition.height
};
} else {
let realAnchor = <IAnchor>anchor;
around = {
top: anchor.y,
left: anchor.x,
width: anchor.width || 1,
height: anchor.height || 2
top: realAnchor.y,
left: realAnchor.x,
width: realAnchor.width || 1,
height: realAnchor.height || 2
};
}
@@ -276,7 +278,7 @@ export class ContextView extends Disposable {
return !!this.delegate;
}
private onDOMEvent(e: Event, onCapture: boolean): void {
private onDOMEvent(e: Event, element: HTMLElement, onCapture: boolean): void {
if (this.delegate) {
if (this.delegate.onDOMEvent) {
this.delegate.onDOMEvent(e, <HTMLElement>document.activeElement);

View File

@@ -6,7 +6,7 @@
import 'vs/css!./dropdown';
import { Gesture, EventType as GestureEventType } from 'vs/base/browser/touch';
import { ActionRunner, IAction, IActionRunner } from 'vs/base/common/actions';
import { BaseActionViewItem, IActionViewItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
import { BaseActionItem, IActionItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
import { IDisposable } from 'vs/base/common/lifecycle';
import { IContextViewProvider, IAnchor, AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { IMenuOptions } from 'vs/base/browser/ui/menu/menu';
@@ -247,7 +247,7 @@ export class DropdownMenu extends BaseDropdown {
getAnchor: () => this.element,
getActions: () => this.actions,
getActionsContext: () => this.menuOptions ? this.menuOptions.context : null,
getActionViewItem: action => this.menuOptions && this.menuOptions.actionViewItemProvider ? this.menuOptions.actionViewItemProvider(action) : undefined,
getActionItem: action => this.menuOptions && this.menuOptions.actionItemProvider ? this.menuOptions.actionItemProvider(action) : undefined,
getKeyBinding: action => this.menuOptions && this.menuOptions.getKeyBinding ? this.menuOptions.getKeyBinding(action) : undefined,
getMenuClassName: () => this.menuClassName,
onHide: () => this.onHide(),
@@ -266,23 +266,23 @@ export class DropdownMenu extends BaseDropdown {
}
}
export class DropdownMenuActionViewItem extends BaseActionViewItem {
export class DropdownMenuActionItem extends BaseActionItem {
private menuActionsOrProvider: any;
private dropdownMenu: DropdownMenu;
private contextMenuProvider: IContextMenuProvider;
private actionViewItemProvider?: IActionViewItemProvider;
private actionItemProvider?: IActionItemProvider;
private keybindings?: (action: IAction) => ResolvedKeybinding | undefined;
private clazz: string | undefined;
private anchorAlignmentProvider: (() => AnchorAlignment) | undefined;
constructor(action: IAction, menuActions: IAction[], contextMenuProvider: IContextMenuProvider, actionViewItemProvider: IActionViewItemProvider | undefined, actionRunner: IActionRunner, keybindings: ((action: IAction) => ResolvedKeybinding | undefined) | undefined, clazz: string | undefined, anchorAlignmentProvider?: () => AnchorAlignment);
constructor(action: IAction, actionProvider: IActionProvider, contextMenuProvider: IContextMenuProvider, actionViewItemProvider: IActionViewItemProvider | undefined, actionRunner: IActionRunner, keybindings: ((action: IAction) => ResolvedKeybinding) | undefined, clazz: string | undefined, anchorAlignmentProvider?: () => AnchorAlignment);
constructor(action: IAction, menuActionsOrProvider: any, contextMenuProvider: IContextMenuProvider, actionViewItemProvider: IActionViewItemProvider | undefined, actionRunner: IActionRunner, keybindings: ((action: IAction) => ResolvedKeybinding | undefined) | undefined, clazz: string | undefined, anchorAlignmentProvider?: () => AnchorAlignment) {
constructor(action: IAction, menuActions: IAction[], contextMenuProvider: IContextMenuProvider, actionItemProvider: IActionItemProvider | undefined, actionRunner: IActionRunner, keybindings: ((action: IAction) => ResolvedKeybinding | undefined) | undefined, clazz: string | undefined, anchorAlignmentProvider?: () => AnchorAlignment);
constructor(action: IAction, actionProvider: IActionProvider, contextMenuProvider: IContextMenuProvider, actionItemProvider: IActionItemProvider | undefined, actionRunner: IActionRunner, keybindings: ((action: IAction) => ResolvedKeybinding) | undefined, clazz: string | undefined, anchorAlignmentProvider?: () => AnchorAlignment);
constructor(action: IAction, menuActionsOrProvider: any, contextMenuProvider: IContextMenuProvider, actionItemProvider: IActionItemProvider | undefined, actionRunner: IActionRunner, keybindings: ((action: IAction) => ResolvedKeybinding | undefined) | undefined, clazz: string | undefined, anchorAlignmentProvider?: () => AnchorAlignment) {
super(null, action);
this.menuActionsOrProvider = menuActionsOrProvider;
this.contextMenuProvider = contextMenuProvider;
this.actionViewItemProvider = actionViewItemProvider;
this.actionItemProvider = actionItemProvider;
this.actionRunner = actionRunner;
this.keybindings = keybindings;
this.clazz = clazz;
@@ -319,7 +319,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
this.dropdownMenu = this._register(new DropdownMenu(container, options));
this.dropdownMenu.menuOptions = {
actionViewItemProvider: this.actionViewItemProvider,
actionItemProvider: this.actionItemProvider,
actionRunner: this.actionRunner,
getKeyBinding: this.keybindings,
context: this._context

View File

@@ -161,7 +161,7 @@ export class InputBox extends Widget {
let tagName = this.options.flexibleHeight ? 'textarea' : 'input';
let wrapper = dom.append(this.element, $('.wrapper'));
this.input = dom.append(wrapper, $(tagName + '.input'));
this.input = <HTMLInputElement>dom.append(wrapper, $(tagName + '.input'));
this.input.setAttribute('autocorrect', 'off');
this.input.setAttribute('autocapitalize', 'off');
this.input.setAttribute('spellcheck', 'false');

View File

@@ -7,7 +7,7 @@ import 'vs/css!./menu';
import * as nls from 'vs/nls';
import * as strings from 'vs/base/common/strings';
import { IActionRunner, IAction, Action } from 'vs/base/common/actions';
import { ActionBar, IActionViewItemProvider, ActionsOrientation, Separator, ActionViewItem, IActionViewItemOptions, BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionBar, IActionItemProvider, ActionsOrientation, Separator, ActionItem, IActionItemOptions, BaseActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ResolvedKeybinding, KeyCode } from 'vs/base/common/keyCodes';
import { addClass, EventType, EventHelper, EventLike, removeTabIndexAndUpdateFocus, isAncestor, hasClass, addDisposableListener, removeClass, append, $, addClasses, removeClasses } from 'vs/base/browser/dom';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
@@ -39,7 +39,7 @@ export const MENU_ESCAPED_MNEMONIC_REGEX: RegExp = createMenuEscapedMnemonicRegE
export interface IMenuOptions {
context?: any;
actionViewItemProvider?: IActionViewItemProvider;
actionItemProvider?: IActionItemProvider;
actionRunner?: IActionRunner;
getKeyBinding?: (action: IAction) => ResolvedKeybinding | undefined;
ariaLabel?: string;
@@ -70,7 +70,7 @@ interface ISubMenuData {
}
export class Menu extends ActionBar {
private mnemonics: Map<string, Array<BaseMenuActionViewItem>>;
private mnemonics: Map<string, Array<MenuActionItem>>;
private menuDisposables: IDisposable[];
private scrollableElement: DomScrollableElement;
private menuElement: HTMLElement;
@@ -88,7 +88,7 @@ export class Menu extends ActionBar {
super(menuElement, {
orientation: ActionsOrientation.VERTICAL,
actionViewItemProvider: action => this.doGetActionViewItem(action, options, parentData),
actionItemProvider: action => this.doGetActionItem(action, options, parentData),
context: options.context,
actionRunner: options.actionRunner,
ariaLabel: options.ariaLabel,
@@ -113,7 +113,7 @@ export class Menu extends ActionBar {
const actions = this.mnemonics.get(key)!;
if (actions.length === 1) {
if (actions[0] instanceof SubmenuMenuActionViewItem) {
if (actions[0] instanceof SubmenuActionItem) {
this.focusItemByElement(actions[0].container);
}
@@ -138,7 +138,7 @@ export class Menu extends ActionBar {
const event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.Home) || event.equals(KeyCode.PageUp)) {
this.focusedItem = this.viewItems.length - 1;
this.focusedItem = this.items.length - 1;
this.focusNext();
EventHelper.stop(e, true);
} else if (event.equals(KeyCode.End) || event.equals(KeyCode.PageDown)) {
@@ -189,7 +189,7 @@ export class Menu extends ActionBar {
parent: this
};
this.mnemonics = new Map<string, Array<BaseMenuActionViewItem>>();
this.mnemonics = new Map<string, Array<MenuActionItem>>();
this.push(actions, { icon: true, label: true, isMenu: true });
@@ -223,7 +223,7 @@ export class Menu extends ActionBar {
container.appendChild(this.scrollableElement.getDomNode());
this.scrollableElement.scanDomNode();
this.viewItems.filter(item => !(item instanceof MenuSeparatorActionViewItem)).forEach((item: BaseMenuActionViewItem, index: number, array: any[]) => {
this.items.filter(item => !(item instanceof MenuSeparatorActionItem)).forEach((item: MenuActionItem, index: number, array: any[]) => {
item.updatePositionInSet(index + 1, array.length);
});
}
@@ -241,9 +241,9 @@ export class Menu extends ActionBar {
this.domNode.style.backgroundColor = bgColor;
container.style.boxShadow = shadow;
if (this.viewItems) {
this.viewItems.forEach(item => {
if (item instanceof BaseMenuActionViewItem || item instanceof MenuSeparatorActionViewItem) {
if (this.items) {
this.items.forEach(item => {
if (item instanceof MenuActionItem || item instanceof MenuSeparatorActionItem) {
item.style(style);
}
});
@@ -263,12 +263,12 @@ export class Menu extends ActionBar {
}
trigger(index: number): void {
if (index <= this.viewItems.length && index >= 0) {
const item = this.viewItems[index];
if (item instanceof SubmenuMenuActionViewItem) {
if (index <= this.items.length && index >= 0) {
const item = this.items[index];
if (item instanceof SubmenuActionItem) {
super.focus(index);
item.open(true);
} else if (item instanceof BaseMenuActionViewItem) {
} else if (item instanceof MenuActionItem) {
super.run(item._action, item._context);
} else {
return;
@@ -295,27 +295,27 @@ export class Menu extends ActionBar {
}
}
private doGetActionViewItem(action: IAction, options: IMenuOptions, parentData: ISubMenuData): BaseActionViewItem {
private doGetActionItem(action: IAction, options: IMenuOptions, parentData: ISubMenuData): BaseActionItem {
if (action instanceof Separator) {
return new MenuSeparatorActionViewItem(options.context, action, { icon: true });
return new MenuSeparatorActionItem(options.context, action, { icon: true });
} else if (action instanceof SubmenuAction) {
const menuActionViewItem = new SubmenuMenuActionViewItem(action, action.entries, parentData, options);
const menuActionItem = new SubmenuActionItem(action, action.entries, parentData, options);
if (options.enableMnemonics) {
const mnemonic = menuActionViewItem.getMnemonic();
if (mnemonic && menuActionViewItem.isEnabled()) {
let actionViewItems: BaseMenuActionViewItem[] = [];
const mnemonic = menuActionItem.getMnemonic();
if (mnemonic && menuActionItem.isEnabled()) {
let actionItems: MenuActionItem[] = [];
if (this.mnemonics.has(mnemonic)) {
actionViewItems = this.mnemonics.get(mnemonic)!;
actionItems = this.mnemonics.get(mnemonic)!;
}
actionViewItems.push(menuActionViewItem);
actionItems.push(menuActionItem);
this.mnemonics.set(mnemonic, actionViewItems);
this.mnemonics.set(mnemonic, actionItems);
}
}
return menuActionViewItem;
return menuActionItem;
} else {
const menuItemOptions: IMenuItemOptions = { enableMnemonics: options.enableMnemonics };
if (options.getKeyBinding) {
@@ -329,32 +329,32 @@ export class Menu extends ActionBar {
}
}
const menuActionViewItem = new BaseMenuActionViewItem(options.context, action, menuItemOptions);
const menuActionItem = new MenuActionItem(options.context, action, menuItemOptions);
if (options.enableMnemonics) {
const mnemonic = menuActionViewItem.getMnemonic();
if (mnemonic && menuActionViewItem.isEnabled()) {
let actionViewItems: BaseMenuActionViewItem[] = [];
const mnemonic = menuActionItem.getMnemonic();
if (mnemonic && menuActionItem.isEnabled()) {
let actionItems: MenuActionItem[] = [];
if (this.mnemonics.has(mnemonic)) {
actionViewItems = this.mnemonics.get(mnemonic)!;
actionItems = this.mnemonics.get(mnemonic)!;
}
actionViewItems.push(menuActionViewItem);
actionItems.push(menuActionItem);
this.mnemonics.set(mnemonic, actionViewItems);
this.mnemonics.set(mnemonic, actionItems);
}
}
return menuActionViewItem;
return menuActionItem;
}
}
}
interface IMenuItemOptions extends IActionViewItemOptions {
interface IMenuItemOptions extends IActionItemOptions {
enableMnemonics?: boolean;
}
class BaseMenuActionViewItem extends BaseActionViewItem {
class MenuActionItem extends BaseActionItem {
public container: HTMLElement;
@@ -562,7 +562,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
}
}
class SubmenuMenuActionViewItem extends BaseMenuActionViewItem {
class SubmenuActionItem extends MenuActionItem {
private mysubmenu: Menu | null;
private submenuContainer: HTMLElement | undefined;
private submenuIndicator: HTMLElement;
@@ -778,7 +778,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem {
}
}
class MenuSeparatorActionViewItem extends ActionViewItem {
class MenuSeparatorActionItem extends ActionItem {
style(style: IMenuStyles): void {
this.label.style.borderBottomColor = style.separatorColor ? `${style.separatorColor}` : null;
}

View File

@@ -41,8 +41,8 @@ class SelectListRenderer implements IListRenderer<ISelectOptionItem, ISelectList
constructor() { }
renderTemplate(container: HTMLElement): ISelectListTemplateData {
const data: ISelectListTemplateData = Object.create(null);
renderTemplate(container: HTMLElement): any {
const data = <ISelectListTemplateData>Object.create(null);
data.disposables = [];
data.root = container;
data.text = dom.append(container, $('.option-text'));
@@ -54,10 +54,10 @@ class SelectListRenderer implements IListRenderer<ISelectOptionItem, ISelectList
}
renderElement(element: ISelectOptionItem, index: number, templateData: ISelectListTemplateData): void {
const data: ISelectListTemplateData = templateData;
const text = element.text;
const decoratorRight = element.decoratorRight;
const isDisabled = element.isDisabled;
const data = <ISelectListTemplateData>templateData;
const text = (<ISelectOptionItem>element).text;
const decoratorRight = (<ISelectOptionItem>element).decoratorRight;
const isDisabled = (<ISelectOptionItem>element).isDisabled;
data.text.textContent = text;
data.decoratorRight.innerText = (!!decoratorRight ? decoratorRight : '');
@@ -73,10 +73,10 @@ class SelectListRenderer implements IListRenderer<ISelectOptionItem, ISelectList
// pseudo-select disabled option
if (isDisabled) {
dom.addClass(data.root, 'option-disabled');
dom.addClass((<HTMLElement>data.root), 'option-disabled');
} else {
// Make sure we do class removal from prior template rendering
dom.removeClass(data.root, 'option-disabled');
dom.removeClass((<HTMLElement>data.root), 'option-disabled');
}
}
@@ -836,9 +836,9 @@ export class SelectBoxList implements ISelectBoxDelegate, IListVirtualDelegate<I
private renderDescriptionMarkdown(text: string): HTMLElement {
const cleanRenderedMarkdown = (element: Node) => {
for (let i = 0; i < element.childNodes.length; i++) {
const child = <Element>element.childNodes.item(i);
const child = element.childNodes.item(i);
const tagName = child.tagName && child.tagName.toLowerCase();
const tagName = (<Element>child).tagName && (<Element>child).tagName.toLowerCase();
if (tagName === 'img') {
element.removeChild(child);
} else {

View File

@@ -234,8 +234,8 @@ export class SplitView extends Disposable {
});
const sashEventMapper = this.orientation === Orientation.VERTICAL
? (e: IBaseSashEvent) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey })
: (e: IBaseSashEvent) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey });
? (e: IBaseSashEvent) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey } as ISashEvent)
: (e: IBaseSashEvent) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey } as ISashEvent);
const onStart = Event.map(sash.onDidStart, sashEventMapper);
const onStartDisposable = onStart(this.onSashStart, this);

View File

@@ -6,8 +6,8 @@
import 'vs/css!./toolbar';
import * as nls from 'vs/nls';
import { Action, IActionRunner, IAction } from 'vs/base/common/actions';
import { ActionBar, ActionsOrientation, IActionViewItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
import { IContextMenuProvider, DropdownMenuActionViewItem } from 'vs/base/browser/ui/dropdown/dropdown';
import { ActionBar, ActionsOrientation, IActionItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
import { IContextMenuProvider, DropdownMenuActionItem } from 'vs/base/browser/ui/dropdown/dropdown';
import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { Disposable } from 'vs/base/common/lifecycle';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
@@ -17,7 +17,7 @@ export const CONTEXT = 'context.toolbar';
export interface IToolBarOptions {
orientation?: ActionsOrientation;
actionViewItemProvider?: IActionViewItemProvider;
actionItemProvider?: IActionItemProvider;
ariaLabel?: string;
getKeyBinding?: (action: IAction) => ResolvedKeybinding | undefined;
actionRunner?: IActionRunner;
@@ -32,7 +32,7 @@ export class ToolBar extends Disposable {
private options: IToolBarOptions;
private actionBar: ActionBar;
private toggleMenuAction: ToggleMenuAction;
private toggleMenuActionViewItem?: DropdownMenuActionViewItem;
private toggleMenuActionItem?: DropdownMenuActionItem;
private hasSecondaryActions: boolean;
private lookupKeybindings: boolean;
@@ -42,7 +42,7 @@ export class ToolBar extends Disposable {
this.options = options;
this.lookupKeybindings = typeof this.options.getKeyBinding === 'function';
this.toggleMenuAction = this._register(new ToggleMenuAction(() => this.toggleMenuActionViewItem && this.toggleMenuActionViewItem.show(), options.toggleMenuTitle));
this.toggleMenuAction = this._register(new ToggleMenuAction(() => this.toggleMenuActionItem && this.toggleMenuActionItem.show(), options.toggleMenuTitle));
let element = document.createElement('div');
element.className = 'monaco-toolbar';
@@ -52,33 +52,33 @@ export class ToolBar extends Disposable {
orientation: options.orientation,
ariaLabel: options.ariaLabel,
actionRunner: options.actionRunner,
actionViewItemProvider: (action: Action) => {
actionItemProvider: (action: Action) => {
// Return special action item for the toggle menu action
if (action.id === ToggleMenuAction.ID) {
// Dispose old
if (this.toggleMenuActionViewItem) {
this.toggleMenuActionViewItem.dispose();
if (this.toggleMenuActionItem) {
this.toggleMenuActionItem.dispose();
}
// Create new
this.toggleMenuActionViewItem = new DropdownMenuActionViewItem(
this.toggleMenuActionItem = new DropdownMenuActionItem(
action,
(<ToggleMenuAction>action).menuActions,
contextMenuProvider,
this.options.actionViewItemProvider,
this.options.actionItemProvider,
this.actionRunner,
this.options.getKeyBinding,
'toolbar-toggle-more',
this.options.anchorAlignmentProvider
);
this.toggleMenuActionViewItem!.setActionContext(this.actionBar.context);
this.toggleMenuActionItem!.setActionContext(this.actionBar.context);
return this.toggleMenuActionViewItem;
return this.toggleMenuActionItem;
}
return options.actionViewItemProvider ? options.actionViewItemProvider(action) : undefined;
return options.actionItemProvider ? options.actionItemProvider(action) : undefined;
}
}));
}
@@ -93,8 +93,8 @@ export class ToolBar extends Disposable {
set context(context: any) {
this.actionBar.context = context;
if (this.toggleMenuActionViewItem) {
this.toggleMenuActionViewItem.setActionContext(context);
if (this.toggleMenuActionItem) {
this.toggleMenuActionItem.setActionContext(context);
}
}
@@ -156,9 +156,9 @@ export class ToolBar extends Disposable {
}
dispose(): void {
if (this.toggleMenuActionViewItem) {
this.toggleMenuActionViewItem.dispose();
this.toggleMenuActionViewItem = undefined;
if (this.toggleMenuActionItem) {
this.toggleMenuActionItem.dispose();
this.toggleMenuActionItem = undefined;
}
super.dispose();

View File

@@ -29,7 +29,7 @@ export interface IActionRunner extends IDisposable {
onDidBeforeRun: Event<IRunEvent>;
}
export interface IActionViewItem {
export interface IActionItem {
actionRunner: IActionRunner;
setActionContext(context: any): void;
render(element: any /* HTMLElement */): void;

View File

@@ -79,7 +79,7 @@ export function getFirstFrame(arg0: IRemoteConsoleLog | string | undefined): ISt
uri: URI.file(matches[1]),
line: Number(matches[2]),
column: Number(matches[3])
};
} as IStackFrame;
}
}

View File

@@ -139,22 +139,19 @@ export function isUNC(path: string): boolean {
}
// Reference: https://en.wikipedia.org/wiki/Filename
const WINDOWS_INVALID_FILE_CHARS = /[\\/:\*\?"<>\|]/g;
const UNIX_INVALID_FILE_CHARS = /[\\/]/g;
const INVALID_FILE_CHARS = isWindows ? /[\\/:\*\?"<>\|]/g : /[\\/]/g;
const WINDOWS_FORBIDDEN_NAMES = /^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])$/i;
export function isValidBasename(name: string | null | undefined, isWindowsOS: boolean = isWindows): boolean {
const invalidFileChars = isWindowsOS ? WINDOWS_INVALID_FILE_CHARS : UNIX_INVALID_FILE_CHARS;
export function isValidBasename(name: string | null | undefined): boolean {
if (!name || name.length === 0 || /^\s+$/.test(name)) {
return false; // require a name that is not just whitespace
}
invalidFileChars.lastIndex = 0; // the holy grail of software development
if (invalidFileChars.test(name)) {
INVALID_FILE_CHARS.lastIndex = 0; // the holy grail of software development
if (INVALID_FILE_CHARS.test(name)) {
return false; // check for certain invalid file characters
}
if (isWindowsOS && WINDOWS_FORBIDDEN_NAMES.test(name)) {
if (isWindows && WINDOWS_FORBIDDEN_NAMES.test(name)) {
return false; // check for certain invalid file names
}
@@ -162,16 +159,16 @@ export function isValidBasename(name: string | null | undefined, isWindowsOS: bo
return false; // check for reserved values
}
if (isWindowsOS && name[name.length - 1] === '.') {
if (isWindows && name[name.length - 1] === '.') {
return false; // Windows: file cannot end with a "."
}
if (isWindowsOS && name.length !== name.trim().length) {
if (isWindows && name.length !== name.trim().length) {
return false; // Windows: file cannot end with a whitespace
}
if (name.length > 255) {
return false; // most file systems do not allow files > 255 length
return false; // most file systems do not allow files > 255 lenth
}
return true;

View File

@@ -197,11 +197,7 @@ function guessMimeTypeByFirstline(firstLine: string): string | null {
}
if (firstLine.length > 0) {
// We want to prioritize associations based on the order they are registered so that the last registered
// association wins over all other. This is for https://github.com/Microsoft/vscode/issues/20074
for (let i = registeredAssociations.length - 1; i >= 0; i--) {
const association = registeredAssociations[i];
for (const association of registeredAssociations) {
if (!association.firstline) {
continue;
}
@@ -234,11 +230,10 @@ export function isUnspecific(mime: string[] | string): boolean {
* 2. Otherwise, if there are other extensions, suggest the first one.
* 3. Otherwise, suggest the prefix.
*/
export function suggestFilename(mode: string | undefined, prefix: string): string {
export function suggestFilename(langId: string | null, prefix: string): string {
const extensions = registeredAssociations
.filter(assoc => !assoc.userConfigured && assoc.extension && assoc.id === mode)
.filter(assoc => !assoc.userConfigured && assoc.extension && assoc.id === langId)
.map(assoc => assoc.extension);
const extensionsWithDotFirst = coalesce(extensions)
.filter(assoc => startsWith(assoc, '.'));

View File

@@ -14,7 +14,7 @@ export function deepClone<T>(obj: T): T {
return obj as any;
}
const result: any = Array.isArray(obj) ? [] : {};
Object.keys(obj as any).forEach((key: string) => {
Object.keys(obj).forEach((key: string) => {
if (obj[key] && typeof obj[key] === 'object') {
result[key] = deepClone(obj[key]);
} else {

View File

@@ -79,7 +79,7 @@ export abstract class Parser {
this._problemReporter.fatal(message);
}
protected static merge<T extends object>(destination: T, source: T, overwrite: boolean): void {
protected static merge<T>(destination: T, source: T, overwrite: boolean): void {
Object.keys(source).forEach((key: string) => {
const destValue = destination[key];
const sourceValue = source[key];

View File

@@ -176,46 +176,28 @@ export function isAbsolutePath(resource: URI): boolean {
/**
* Returns true if the URI path has a trailing path separator
*/
export function hasTrailingPathSeparator(resource: URI, sep: string = paths.sep): boolean {
export function hasTrailingPathSeparator(resource: URI): boolean {
if (resource.scheme === Schemas.file) {
const fsp = originalFSPath(resource);
return fsp.length > extpath.getRoot(fsp).length && fsp[fsp.length - 1] === sep;
return fsp.length > extpath.getRoot(fsp).length && fsp[fsp.length - 1] === paths.sep;
} else {
const p = resource.path;
return p.length > 1 && p.charCodeAt(p.length - 1) === CharCode.Slash; // ignore the slash at offset 0
}
}
/**
* Removes a trailing path separator, if there's one.
* Removes a trailing path seperator, if theres one.
* Important: Doesn't remove the first slash, it would make the URI invalid
*/
export function removeTrailingPathSeparator(resource: URI, sep: string = paths.sep): URI {
if (hasTrailingPathSeparator(resource, sep)) {
export function removeTrailingPathSeparator(resource: URI): URI {
if (hasTrailingPathSeparator(resource)) {
return resource.with({ path: resource.path.substr(0, resource.path.length - 1) });
}
return resource;
}
/**
* Adds a trailing path separator to the URI if there isn't one already.
* For example, c:\ would be unchanged, but c:\users would become c:\users\
*/
export function addTrailingPathSeparator(resource: URI, sep: string = paths.sep): URI {
let isRootSep: boolean = false;
if (resource.scheme === Schemas.file) {
const fsp = originalFSPath(resource);
isRootSep = ((fsp !== undefined) && (fsp.length === extpath.getRoot(fsp).length) && (fsp[fsp.length - 1] === sep));
} else {
sep = '/';
const p = resource.path;
isRootSep = p.length === 1 && p.charCodeAt(p.length - 1) === CharCode.Slash;
}
if (!isRootSep && !hasTrailingPathSeparator(resource, sep)) {
return resource.with({ path: resource.path + '/' });
}
return resource;
}
/**
* Returns a relative path between two URIs. If the URIs don't have the same schema or authority, `undefined` is returned.

View File

@@ -233,7 +233,7 @@ export function regExpLeadsToEndlessLoop(regexp: RegExp): boolean {
// We check against an empty string. If the regular expression doesn't advance
// (e.g. ends in an endless loop) it will match an empty string.
const match = regexp.exec('');
return !!(match && regexp.lastIndex === 0);
return !!(match && <any>regexp.lastIndex === 0);
}
export function regExpContainsBackreference(regexpValue: string): boolean {

View File

@@ -670,15 +670,4 @@ export async function mkdirp(path: string, mode?: number, token?: CancellationTo
// Any other error
return Promise.reject(error);
}
}
// See https://github.com/Microsoft/vscode/issues/30180
const WIN32_MAX_FILE_SIZE = 300 * 1024 * 1024; // 300 MB
const GENERAL_MAX_FILE_SIZE = 16 * 1024 * 1024 * 1024; // 16 GB
// See https://github.com/v8/v8/blob/5918a23a3d571b9625e5cce246bdd5b46ff7cd8b/src/heap/heap.cc#L149
const WIN32_MAX_HEAP_SIZE = 700 * 1024 * 1024; // 700 MB
const GENERAL_MAX_HEAP_SIZE = 700 * 2 * 1024 * 1024; // 1400 MB
export const MAX_FILE_SIZE = process.arch === 'ia32' ? WIN32_MAX_FILE_SIZE : GENERAL_MAX_FILE_SIZE;
export const MAX_HEAP_SIZE = process.arch === 'ia32' ? WIN32_MAX_HEAP_SIZE : GENERAL_MAX_HEAP_SIZE;
}

View File

@@ -159,7 +159,7 @@ export function asText(context: IRequestContext): Promise<string | null> {
});
}
export function asJson<T = {}>(context: IRequestContext): Promise<T | null> {
export function asJson<T>(context: IRequestContext): Promise<T | null> {
return new Promise((c, e) => {
if (!isSuccess(context)) {
return e('Server returned ' + context.res.statusCode);

View File

@@ -218,7 +218,7 @@ class ProtocolReader extends Disposable {
// save new state => next time will read the body
this._state.readHead = false;
this._state.readLen = buff.readUInt32BE(9);
this._state.messageType = buff.readUInt8(0);
this._state.messageType = <ProtocolMessageType>buff.readUInt8(0);
this._state.id = buff.readUInt32BE(1);
this._state.ack = buff.readUInt32BE(5);
} else {

View File

@@ -36,11 +36,11 @@ let IDS = 0;
export class QuickOpenItemAccessorClass implements IItemAccessor<QuickOpenEntry> {
getItemLabel(entry: QuickOpenEntry): string | null {
return types.withUndefinedAsNull(entry.getLabel());
return entry.getLabel();
}
getItemDescription(entry: QuickOpenEntry): string | null {
return types.withUndefinedAsNull(entry.getDescription());
return entry.getDescription();
}
getItemPath(entry: QuickOpenEntry): string | undefined {
@@ -75,15 +75,15 @@ export class QuickOpenEntry {
/**
* The label of the entry to identify it from others in the list
*/
getLabel(): string | undefined {
return undefined;
getLabel(): string | null {
return null;
}
/**
* The options for the label to use for this entry
*/
getLabelOptions(): IIconLabelValueOptions | undefined {
return undefined;
getLabelOptions(): IIconLabelValueOptions | null {
return null;
}
/**
@@ -97,51 +97,51 @@ export class QuickOpenEntry {
/**
* Detail information about the entry that is optional and can be shown below the label
*/
getDetail(): string | undefined {
return undefined;
getDetail(): string | null {
return null;
}
/**
* The icon of the entry to identify it from others in the list
*/
getIcon(): string | undefined {
return undefined;
getIcon(): string | null {
return null;
}
/**
* A secondary description that is optional and can be shown right to the label
*/
getDescription(): string | undefined {
return undefined;
getDescription(): string | null {
return null;
}
/**
* A tooltip to show when hovering over the entry.
*/
getTooltip(): string | undefined {
return undefined;
getTooltip(): string | null {
return null;
}
/**
* A tooltip to show when hovering over the description portion of the entry.
*/
getDescriptionTooltip(): string | undefined {
return undefined;
getDescriptionTooltip(): string | null {
return null;
}
/**
* An optional keybinding to show for an entry.
*/
getKeybinding(): ResolvedKeybinding | undefined {
return undefined;
getKeybinding(): ResolvedKeybinding | null {
return null;
}
/**
* A resource for this entry. Resource URIs can be used to compare different kinds of entries and group
* them together.
*/
getResource(): URI | undefined {
return undefined;
getResource(): URI | null {
return null;
}
/**
@@ -229,11 +229,11 @@ export class QuickOpenEntryGroup extends QuickOpenEntry {
this.withBorder = showBorder;
}
getLabel(): string | undefined {
getLabel(): string | null {
return this.entry ? this.entry.getLabel() : super.getLabel();
}
getLabelOptions(): IIconLabelValueOptions | undefined {
getLabelOptions(): IIconLabelValueOptions | null {
return this.entry ? this.entry.getLabelOptions() : super.getLabelOptions();
}
@@ -241,19 +241,19 @@ export class QuickOpenEntryGroup extends QuickOpenEntry {
return this.entry ? this.entry.getAriaLabel() : super.getAriaLabel();
}
getDetail(): string | undefined {
getDetail(): string | null {
return this.entry ? this.entry.getDetail() : super.getDetail();
}
getResource(): URI | undefined {
getResource(): URI | null {
return this.entry ? this.entry.getResource() : super.getResource();
}
getIcon(): string | undefined {
getIcon(): string | null {
return this.entry ? this.entry.getIcon() : super.getIcon();
}
getDescription(): string | undefined {
getDescription(): string | null {
return this.entry ? this.entry.getDescription() : super.getDescription();
}
@@ -459,13 +459,13 @@ class Renderer implements IRenderer<QuickOpenEntry> {
// Label
const options: IIconLabelValueOptions = entry.getLabelOptions() || Object.create(null);
options.matches = labelHighlights || [];
options.title = entry.getTooltip();
options.descriptionTitle = entry.getDescriptionTooltip() || entry.getDescription(); // tooltip over description because it could overflow
options.title = types.withNullAsUndefined(entry.getTooltip());
options.descriptionTitle = entry.getDescriptionTooltip() || types.withNullAsUndefined(entry.getDescription()); // tooltip over description because it could overflow
options.descriptionMatches = descriptionHighlights || [];
data.label.setLabel(types.withNullAsUndefined(entry.getLabel()), entry.getDescription(), options);
data.label.setLabel(types.withNullAsUndefined(entry.getLabel()), types.withNullAsUndefined(entry.getDescription()), options);
// Meta
data.detail.set(entry.getDetail(), detailHighlights);
data.detail.set(types.withNullAsUndefined(entry.getDetail()), detailHighlights);
// Keybinding
data.keybinding.set(entry.getKeybinding()!);
@@ -556,7 +556,7 @@ export class QuickOpenModel implements
}
getLabel(entry: QuickOpenEntry): string | null {
return types.withUndefinedAsNull(entry.getLabel());
return entry.getLabel();
}
getAriaLabel(entry: QuickOpenEntry): string {

View File

@@ -6,7 +6,6 @@ import * as assert from 'assert';
import { guessMimeTypes, registerTextMime, suggestFilename } from 'vs/base/common/mime';
suite('Mime', () => {
test('Dynamically Register Text Mime', () => {
let guess = guessMimeTypes('foo.monaco');
assert.deepEqual(guess, ['application/unknown']);
@@ -57,11 +56,6 @@ suite('Mime', () => {
registerTextMime({ id: 'docker', filepattern: 'dockerfile*', mime: 'text/looser' });
guess = guessMimeTypes('dockerfile');
assert.deepEqual(guess, ['text/winner', 'text/plain']);
registerTextMime({ id: 'azure-looser', mime: 'text/azure-looser', firstline: /azure/ });
registerTextMime({ id: 'azure-winner', mime: 'text/azure-winner', firstline: /azure/ });
guess = guessMimeTypes('azure', 'azure');
assert.deepEqual(guess, ['text/azure-winner', 'text/plain']);
});
test('Specificity priority 1', () => {

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { dirname, basename, distinctParents, joinPath, isEqual, isEqualOrParent, hasToIgnoreCase, normalizePath, isAbsolutePath, relativePath, removeTrailingPathSeparator, hasTrailingPathSeparator, resolvePath, addTrailingPathSeparator } from 'vs/base/common/resources';
import { dirname, basename, distinctParents, joinPath, isEqual, isEqualOrParent, hasToIgnoreCase, normalizePath, isAbsolutePath, relativePath, removeTrailingPathSeparator, hasTrailingPathSeparator, resolvePath } from 'vs/base/common/resources';
import { URI } from 'vs/base/common/uri';
import { isWindows } from 'vs/base/common/platform';
import { toSlashes } from 'vs/base/common/extpath';
@@ -178,9 +178,6 @@ suite('Resources', () => {
assertEqualURI(removeTrailingPathSeparator(u1), expected, u1.toString());
}
function assertAddTrailingSeparator(u1: URI, expected: URI) {
assertEqualURI(addTrailingPathSeparator(u1), expected, u1.toString());
}
test('trailingPathSeparator', () => {
assertTrailingSeparator(URI.parse('foo://a/foo'), false);
@@ -193,11 +190,6 @@ suite('Resources', () => {
assertRemoveTrailingSeparator(URI.parse('foo://a/'), URI.parse('foo://a/'));
assertRemoveTrailingSeparator(URI.parse('foo://a'), URI.parse('foo://a'));
assertAddTrailingSeparator(URI.parse('foo://a/foo'), URI.parse('foo://a/foo/'));
assertAddTrailingSeparator(URI.parse('foo://a/foo/'), URI.parse('foo://a/foo/'));
assertAddTrailingSeparator(URI.parse('foo://a/'), URI.parse('foo://a/'));
assertAddTrailingSeparator(URI.parse('foo://a'), URI.parse('foo://a/'));
if (isWindows) {
assertTrailingSeparator(URI.file('c:\\a\\foo'), false);
assertTrailingSeparator(URI.file('c:\\a\\foo\\'), true);
@@ -210,12 +202,6 @@ suite('Resources', () => {
assertRemoveTrailingSeparator(URI.file('c:\\'), URI.file('c:\\'));
assertRemoveTrailingSeparator(URI.file('\\\\server\\share\\some\\'), URI.file('\\\\server\\share\\some'));
assertRemoveTrailingSeparator(URI.file('\\\\server\\share\\'), URI.file('\\\\server\\share\\'));
assertAddTrailingSeparator(URI.file('c:\\a\\foo'), URI.file('c:\\a\\foo\\'));
assertAddTrailingSeparator(URI.file('c:\\a\\foo\\'), URI.file('c:\\a\\foo\\'));
assertAddTrailingSeparator(URI.file('c:\\'), URI.file('c:\\'));
assertAddTrailingSeparator(URI.file('\\\\server\\share\\some'), URI.file('\\\\server\\share\\some\\'));
assertAddTrailingSeparator(URI.file('\\\\server\\share\\some\\'), URI.file('\\\\server\\share\\some\\'));
} else {
assertTrailingSeparator(URI.file('/foo/bar'), false);
assertTrailingSeparator(URI.file('/foo/bar/'), true);
@@ -224,16 +210,12 @@ suite('Resources', () => {
assertRemoveTrailingSeparator(URI.file('/foo/bar'), URI.file('/foo/bar'));
assertRemoveTrailingSeparator(URI.file('/foo/bar/'), URI.file('/foo/bar'));
assertRemoveTrailingSeparator(URI.file('/'), URI.file('/'));
assertAddTrailingSeparator(URI.file('/foo/bar'), URI.file('/foo/bar/'));
assertAddTrailingSeparator(URI.file('/foo/bar/'), URI.file('/foo/bar/'));
assertAddTrailingSeparator(URI.file('/'), URI.file('/'));
}
});
function assertEqualURI(actual: URI, expected: URI, message?: string) {
if (!isEqual(expected, actual)) {
assert.equal(actual.toString(), expected.toString(), message);
assert.equal(expected.toString(), actual.toString(), message);
}
}

View File

@@ -20,7 +20,7 @@ suite('Config', () => {
const newDir = path.join(parentDir, 'config', id);
const testFile = path.join(newDir, 'config.json');
let watcher = new ConfigWatcher<{}>(testFile);
let watcher = new ConfigWatcher(testFile);
let config = watcher.getConfig();
assert.ok(config);

View File

@@ -1,15 +0,0 @@
<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<!-- Disable pinch zooming -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
</head>
<body class="vs-dark" aria-label="">
</body>
<!-- Startup via workbench.js -->
<script src="../../../../../out/vs/code/browser/workbench/workbench.js"></script>
</html>

View File

@@ -1,40 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'use strict';
(function () {
function loadScript(path, callback) {
let script = document.createElement('script');
script.onload = callback;
script.async = true;
script.type = 'text/javascript';
script.src = path;
document.head.appendChild(script);
}
loadScript('../../../../../out/vs/loader.js', function () {
// @ts-ignore
require.config({
baseUrl: `${window.location.origin}/out`
});
// @ts-ignore
require([
'vs/workbench/workbench.web.main',
'vs/nls!vs/workbench/workbench.web.main',
'vs/css!vs/workbench/workbench.web.main'
],
// @ts-ignore
function () {
// @ts-ignore
require('vs/workbench/browser/web.main').main().then(undefined, console.error);
});
});
})();

View File

@@ -106,8 +106,8 @@ function showPartsSplash(configuration) {
const style = document.createElement('style');
style.className = 'initialShellColors';
document.head.appendChild(style);
document.body.className = baseTheme;
style.innerHTML = `body { background-color: ${shellBackground}; color: ${shellForeground}; }`;
document.body.className = `monaco-shell ${baseTheme}`;
style.innerHTML = `.monaco-shell { background-color: ${shellBackground}; color: ${shellForeground}; }`;
if (data && data.layoutInfo) {
// restore parts if possible (we might not always store layout info)

View File

@@ -0,0 +1,12 @@
<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body class="monaco-shell vs-dark" aria-label="">
</body>
<!-- Startup via workbench.nodeless.js -->
<script src="workbench.nodeless.js"></script>
</html>

View File

@@ -0,0 +1,67 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'use strict';
(function () {
function uriFromPath(_path) {
let pathName = _path.replace(/\\/g, '/');
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
pathName = '/' + pathName;
}
let uri;
if (navigator.userAgent.indexOf('Windows') >= 0 && pathName.startsWith('//')) { // specially handle Windows UNC paths
uri = encodeURI('file:' + pathName);
} else {
uri = encodeURI('file://' + pathName);
}
return uri.replace(/#/g, '%23');
}
function parseURLQueryArgs() {
const search = window.location.search || '';
return search.split(/[?&]/)
.filter(function (param) { return !!param; })
.map(function (param) { return param.split('='); })
.filter(function (param) { return param.length === 2; })
.reduce(function (r, param) { r[param[0]] = decodeURIComponent(param[1]); return r; }, {});
}
function loadScript(path, callback) {
let script = document.createElement('script');
script.onload = callback;
script.async = true;
script.type = 'text/javascript';
script.src = path;
document.head.appendChild(script);
}
loadScript('../../../../../out/vs/loader.js', function () {
const args = parseURLQueryArgs();
const configuration = JSON.parse(args['config'] || '{}') || {};
// @ts-ignore
require.config({
baseUrl: uriFromPath(configuration.appRoot) + '/out',
});
// @ts-ignore
require([
'vs/workbench/workbench.nodeless.main',
'vs/nls!vs/workbench/workbench.nodeless.main',
'vs/css!vs/workbench/workbench.nodeless.main'
], function () {
// @ts-ignore
require('vs/workbench/browser/nodeless.main').main().then(undefined, console.error);
});
});
})();

View File

@@ -234,7 +234,7 @@ export class CodeApplication extends Disposable {
ipc.on('vscode:fetchShellEnv', (event: Event) => {
const webContents = event.sender;
getShellEnvironment(this.logService).then(shellEnv => {
getShellEnvironment().then(shellEnv => {
if (!webContents.isDestroyed()) {
webContents.send('vscode:acceptShellEnv', shellEnv);
}
@@ -678,7 +678,7 @@ export class CodeApplication extends Disposable {
historyMainService.onRecentlyOpenedChange(() => historyMainService.updateWindowsJumpList());
// Start shared process after a while
const sharedProcessSpawn = this._register(new RunOnceScheduler(() => getShellEnvironment(this.logService).then(userEnv => this.sharedProcess.spawn(userEnv)), 3000));
const sharedProcessSpawn = this._register(new RunOnceScheduler(() => getShellEnvironment().then(userEnv => this.sharedProcess.spawn(userEnv)), 3000));
sharedProcessSpawn.schedule();
}

View File

@@ -55,7 +55,7 @@ function setupIPC(accessor: ServicesAccessor): Promise<Server> {
logService.trace('Sending some foreground love to the running instance:', processId);
try {
const { allowSetForegroundWindow } = require.__$__nodeRequire('windows-foreground-love');
const { allowSetForegroundWindow } = <any>require.__$__nodeRequire('windows-foreground-love');
allowSetForegroundWindow(processId);
} catch (e) {
// noop

View File

@@ -8,7 +8,7 @@ import * as objects from 'vs/base/common/objects';
import * as nls from 'vs/nls';
import { URI } from 'vs/base/common/uri';
import { IStateService } from 'vs/platform/state/common/state';
import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage, Rectangle, Display } from 'electron';
import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage } from 'electron';
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
import { ILogService } from 'vs/platform/log/common/log';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -25,6 +25,7 @@ import * as perf from 'vs/base/common/performance';
import { resolveMarketplaceHeaders } from 'vs/platform/extensionManagement/node/extensionGalleryService';
import { getBackgroundColor } from 'vs/code/electron-main/theme';
import { RunOnceScheduler } from 'vs/base/common/async';
import { withNullAsUndefined } from 'vs/base/common/types';
import { endsWith } from 'vs/base/common/strings';
export interface IWindowCreationOptions {
@@ -79,6 +80,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
private readonly touchBarGroups: Electron.TouchBarSegmentedControl[];
private nodeless: boolean;
constructor(
config: IWindowCreationOptions,
@ILogService private readonly logService: ILogService,
@@ -95,6 +98,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
this._readyState = ReadyState.NONE;
this.whenReadyCallbacks = [];
this.nodeless = !!(environmentService.args.nodeless && !environmentService.isBuilt);
// create browser window
this.createBrowserWindow(config);
@@ -124,7 +129,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
height: this.windowState.height,
x: this.windowState.x,
y: this.windowState.y,
backgroundColor: getBackgroundColor(this.stateService),
backgroundColor: this.nodeless ? undefined : getBackgroundColor(this.stateService),
minWidth: CodeWindow.MIN_WIDTH,
minHeight: CodeWindow.MIN_HEIGHT,
show: !isFullscreenOrMaximized,
@@ -138,6 +143,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
}
};
if (this.nodeless) {
options.webPreferences!.nodeIntegration = false; // simulate Electron 5 behaviour
}
if (isLinux) {
options.icon = path.join(this.environmentService.appRoot, 'resources/linux/code.png'); // Windows and Mac are better off using the embedded icon(s)
}
@@ -192,6 +201,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
}
}
if (this.nodeless) {
this._win.webContents.toggleDevTools();
}
this._lastFocusTime = Date.now(); // since we show directly, we need to set the last focus time too
}
@@ -627,6 +640,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
}
private doGetUrl(config: object): string {
if (this.nodeless) {
return `${require.toUrl('vs/code/electron-browser/workbench/workbench.nodeless.html')}?config=${encodeURIComponent(JSON.stringify(config))}`;
}
return `${require.toUrl('vs/code/electron-browser/workbench/workbench.html')}?config=${encodeURIComponent(JSON.stringify(config))}`;
}
@@ -692,55 +709,66 @@ export class CodeWindow extends Disposable implements ICodeWindow {
private restoreWindowState(state?: IWindowState): IWindowState {
if (state) {
try {
state = this.validateWindowState(state);
state = withNullAsUndefined(this.validateWindowState(state));
} catch (err) {
this.logService.warn(`Unexpected error validating window state: ${err}\n${err.stack}`); // somehow display API can be picky about the state to validate
}
}
return state || defaultWindowState();
if (!state) {
state = defaultWindowState();
}
return state;
}
private validateWindowState(state: IWindowState): IWindowState | undefined {
private validateWindowState(state: IWindowState): IWindowState | null {
if (!state) {
return null;
}
if (typeof state.x !== 'number'
|| typeof state.y !== 'number'
|| typeof state.width !== 'number'
|| typeof state.height !== 'number'
) {
return undefined;
return null;
}
if (state.width <= 0 || state.height <= 0) {
return undefined;
return null;
}
const displays = screen.getAllDisplays();
// Single Monitor: be strict about x/y positioning
if (displays.length === 1) {
const displayWorkingArea = this.getWorkingArea(displays[0]);
if (state.mode !== WindowMode.Maximized && displayWorkingArea) {
if (state.x < displayWorkingArea.x) {
state.x = displayWorkingArea.x; // prevent window from falling out of the screen to the left
const displayBounds = displays[0].bounds;
// Careful with maximized: in that mode x/y can well be negative!
if (state.mode !== WindowMode.Maximized && displayBounds.width > 0 && displayBounds.height > 0 /* Linux X11 sessions sometimes report wrong display bounds */) {
if (state.x < displayBounds.x) {
state.x = displayBounds.x; // prevent window from falling out of the screen to the left
}
if (state.y < displayWorkingArea.y) {
state.y = displayWorkingArea.y; // prevent window from falling out of the screen to the top
if (state.y < displayBounds.y) {
state.y = displayBounds.y; // prevent window from falling out of the screen to the top
}
if (state.x > (displayWorkingArea.x + displayWorkingArea.width)) {
state.x = displayWorkingArea.x; // prevent window from falling out of the screen to the right
if (state.x > (displayBounds.x + displayBounds.width)) {
state.x = displayBounds.x; // prevent window from falling out of the screen to the right
}
if (state.y > (displayWorkingArea.y + displayWorkingArea.height)) {
state.y = displayWorkingArea.y; // prevent window from falling out of the screen to the bottom
if (state.y > (displayBounds.y + displayBounds.height)) {
state.y = displayBounds.y; // prevent window from falling out of the screen to the bottom
}
if (state.width > displayWorkingArea.width) {
state.width = displayWorkingArea.width; // prevent window from exceeding display bounds width
if (state.width > displayBounds.width) {
state.width = displayBounds.width; // prevent window from exceeding display bounds width
}
if (state.height > displayWorkingArea.height) {
state.height = displayWorkingArea.height; // prevent window from exceeding display bounds height
if (state.height > displayBounds.height) {
state.height = displayBounds.height; // prevent window from exceeding display bounds height
}
}
@@ -766,14 +794,12 @@ export class CodeWindow extends Disposable implements ICodeWindow {
// Multi Monitor (non-fullscreen): be less strict because metrics can be crazy
const bounds = { x: state.x, y: state.y, width: state.width, height: state.height };
const display = screen.getDisplayMatching(bounds);
const displayWorkingArea = this.getWorkingArea(display);
if (
display && // we have a display matching the desired bounds
displayWorkingArea && // we have valid working area bounds
bounds.x < displayWorkingArea.x + displayWorkingArea.width && // prevent window from falling out of the screen to the right
bounds.y < displayWorkingArea.y + displayWorkingArea.height && // prevent window from falling out of the screen to the bottom
bounds.x + bounds.width > displayWorkingArea.x && // prevent window from falling out of the screen to the left
bounds.y + bounds.height > displayWorkingArea.y // prevent window from falling out of the scree nto the top
display && // we have a display matching the desired bounds
bounds.x < display.bounds.x + display.bounds.width && // prevent window from falling out of the screen to the right
bounds.y < display.bounds.y + display.bounds.height && // prevent window from falling out of the screen to the bottom
bounds.x + bounds.width > display.bounds.x && // prevent window from falling out of the screen to the left
bounds.y + bounds.height > display.bounds.y // prevent window from falling out of the scree nto the top
) {
if (state.mode === WindowMode.Maximized) {
const defaults = defaultWindowState(WindowMode.Maximized); // when maximized, make sure we have good values when the user restores the window
@@ -786,25 +812,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
return state;
}
return undefined;
}
private getWorkingArea(display: Display): Rectangle | undefined {
// Prefer the working area of the display to account for taskbars on the
// desktop being positioned somewhere (https://github.com/Microsoft/vscode/issues/50830).
//
// Linux X11 sessions sometimes report wrong display bounds, so we validate
// the reported sizes are positive.
if (display.workArea.width > 0 && display.workArea.height > 0) {
return display.workArea;
}
if (display.bounds.width > 0 && display.bounds.height > 0) {
return display.bounds;
}
return undefined;
return null;
}
getBounds(): Electron.Rectangle {

View File

@@ -112,10 +112,6 @@ export class Main {
private async installExtensions(extensions: string[], force: boolean): Promise<void> {
const failed: string[] = [];
const installedExtensionsManifests: IExtensionManifest[] = [];
if (extensions.length) {
console.log(localize('installingExtensions', "Installing extensions..."));
}
for (const extension of extensions) {
try {
const manifest = await this.installExtension(extension, force);
@@ -146,11 +142,11 @@ export class Main {
if (valid) {
return this.extensionManagementService.install(URI.file(extension)).then(id => {
console.log(localize('successVsixInstall', "Extension '{0}' was successfully installed.", getBaseLabel(extension)));
console.log(localize('successVsixInstall', "Extension '{0}' was successfully installed!", getBaseLabel(extension)));
return manifest;
}, error => {
if (isPromiseCanceledError(error)) {
console.log(localize('cancelVsixInstall', "Cancelled installing extension '{0}'.", getBaseLabel(extension)));
console.log(localize('cancelVsixInstall', "Cancelled installing Extension '{0}'.", getBaseLabel(extension)));
return null;
} else {
return Promise.reject(error);
@@ -195,7 +191,9 @@ export class Main {
console.log(localize('forceUpdate', "Extension '{0}' v{1} is already installed, but a newer version {2} is available in the marketplace. Use '--force' option to update to newer version.", id, installedExtension.manifest.version, extension.version));
return Promise.resolve(null);
}
console.log(localize('updateMessage', "Updating the extension '{0}' to the version {1}", id, extension.version));
console.log(localize('updateMessage', "Updating the Extension '{0}' to the version {1}", id, extension.version));
} else {
console.log(localize('foundExtension', "Found '{0}' in the marketplace.", id));
}
await this.installFromGallery(id, extension);
return manifest;
@@ -212,7 +210,7 @@ export class Main {
const newer = installedExtensions.filter(local => areSameExtensions(extensionIdentifier, local.identifier) && semver.gt(local.manifest.version, manifest.version))[0];
if (newer && !force) {
console.log(localize('forceDowngrade', "A newer version of extension '{0}' v{1} is already installed. Use '--force' option to downgrade to older version.", newer.identifier.id, newer.manifest.version, manifest.version));
console.log(localize('forceDowngrade', "A newer version of this extension '{0}' v{1} is already installed. Use '--force' option to downgrade to older version.", newer.identifier.id, newer.manifest.version, manifest.version));
return false;
}
@@ -220,14 +218,14 @@ export class Main {
}
private async installFromGallery(id: string, extension: IGalleryExtension): Promise<void> {
console.log(localize('installing', "Installing extension '{0}' v{1}...", id, extension.version));
console.log(localize('installing', "Installing..."));
try {
await this.extensionManagementService.installFromGallery(extension);
console.log(localize('successInstall', "Extension '{0}' v{1} was successfully installed.", id, extension.version));
console.log(localize('successInstall', "Extension '{0}' v{1} was successfully installed!", id, extension.version));
} catch (error) {
if (isPromiseCanceledError(error)) {
console.log(localize('cancelVsixInstall', "Cancelled installing extension '{0}'.", id));
console.log(localize('cancelVsixInstall', "Cancelled installing Extension '{0}'.", id));
} else {
throw error;
}

View File

@@ -7,16 +7,11 @@ import * as cp from 'child_process';
import { assign } from 'vs/base/common/objects';
import { generateUuid } from 'vs/base/common/uuid';
import { isWindows } from 'vs/base/common/platform';
import { ILogService } from 'vs/platform/log/common/log';
function getUnixShellEnvironment(logService: ILogService): Promise<typeof process.env> {
function getUnixShellEnvironment(): Promise<typeof process.env> {
const promise = new Promise<typeof process.env>((resolve, reject) => {
const runAsNode = process.env['ELECTRON_RUN_AS_NODE'];
logService.trace('getUnixShellEnvironment#runAsNode', runAsNode);
const noAttach = process.env['ELECTRON_NO_ATTACH_CONSOLE'];
logService.trace('getUnixShellEnvironment#noAttach', noAttach);
const mark = generateUuid().replace(/-/g, '').substr(0, 12);
const regex = new RegExp(mark + '(.*)' + mark);
@@ -26,9 +21,6 @@ function getUnixShellEnvironment(logService: ILogService): Promise<typeof proces
});
const command = `'${process.execPath}' -p '"${mark}" + JSON.stringify(process.env) + "${mark}"'`;
logService.trace('getUnixShellEnvironment#env', env);
logService.trace('getUnixShellEnvironment#spawn', command);
const child = cp.spawn(process.env.SHELL!, ['-ilc', command], {
detached: true,
stdio: ['ignore', 'pipe', process.stderr],
@@ -45,8 +37,6 @@ function getUnixShellEnvironment(logService: ILogService): Promise<typeof proces
}
const raw = Buffer.concat(buffers).toString('utf8');
logService.trace('getUnixShellEnvironment#raw', raw);
const match = regex.exec(raw);
const rawStripped = match ? match[1] : '{}';
@@ -68,10 +58,8 @@ function getUnixShellEnvironment(logService: ILogService): Promise<typeof proces
// https://github.com/Microsoft/vscode/issues/22593#issuecomment-336050758
delete env['XDG_RUNTIME_DIR'];
logService.trace('getUnixShellEnvironment#result', env);
resolve(env);
} catch (err) {
logService.error('getUnixShellEnvironment#error', err);
reject(err);
}
});
@@ -89,17 +77,14 @@ let _shellEnv: Promise<typeof process.env>;
* This should only be done when Code itself is not launched
* from within a shell.
*/
export function getShellEnvironment(logService: ILogService): Promise<typeof process.env> {
export function getShellEnvironment(): Promise<typeof process.env> {
if (_shellEnv === undefined) {
if (isWindows) {
logService.trace('getShellEnvironment: runing on windows, skipping');
_shellEnv = Promise.resolve({});
} else if (process.env['VSCODE_CLI'] === '1') {
logService.trace('getShellEnvironment: runing on CLI, skipping');
_shellEnv = Promise.resolve({});
} else {
logService.trace('getShellEnvironment: running on Unix');
_shellEnv = getUnixShellEnvironment(logService);
_shellEnv = getUnixShellEnvironment();
}
}

View File

@@ -301,13 +301,13 @@ export namespace CoreNavigationCommands {
export const MoveTo: CoreEditorCommand = registerEditorCommand(new BaseMoveToCommand({
id: '_moveTo',
inSelectionMode: false,
precondition: undefined
precondition: null
}));
export const MoveToSelect: CoreEditorCommand = registerEditorCommand(new BaseMoveToCommand({
id: '_moveToSelect',
inSelectionMode: true,
precondition: undefined
precondition: null
}));
abstract class ColumnSelectCommand extends CoreEditorCommand {
@@ -330,7 +330,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'columnSelect',
precondition: undefined
precondition: null
});
}
@@ -354,7 +354,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'cursorColumnSelectLeft',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -373,7 +373,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'cursorColumnSelectRight',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -405,7 +405,7 @@ export namespace CoreNavigationCommands {
export const CursorColumnSelectUp: CoreEditorCommand = registerEditorCommand(new ColumnSelectUpCommand({
isPaged: false,
id: 'cursorColumnSelectUp',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -417,7 +417,7 @@ export namespace CoreNavigationCommands {
export const CursorColumnSelectPageUp: CoreEditorCommand = registerEditorCommand(new ColumnSelectUpCommand({
isPaged: true,
id: 'cursorColumnSelectPageUp',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -443,7 +443,7 @@ export namespace CoreNavigationCommands {
export const CursorColumnSelectDown: CoreEditorCommand = registerEditorCommand(new ColumnSelectDownCommand({
isPaged: false,
id: 'cursorColumnSelectDown',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -455,7 +455,7 @@ export namespace CoreNavigationCommands {
export const CursorColumnSelectPageDown: CoreEditorCommand = registerEditorCommand(new ColumnSelectDownCommand({
isPaged: true,
id: 'cursorColumnSelectPageDown',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -468,7 +468,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'cursorMove',
precondition: undefined,
precondition: null,
description: CursorMove_.description
});
}
@@ -531,7 +531,7 @@ export namespace CoreNavigationCommands {
value: 1
},
id: 'cursorLeft',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -548,7 +548,7 @@ export namespace CoreNavigationCommands {
value: 1
},
id: 'cursorLeftSelect',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -564,7 +564,7 @@ export namespace CoreNavigationCommands {
value: 1
},
id: 'cursorRight',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -581,7 +581,7 @@ export namespace CoreNavigationCommands {
value: 1
},
id: 'cursorRightSelect',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -597,7 +597,7 @@ export namespace CoreNavigationCommands {
value: 1
},
id: 'cursorUp',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -614,7 +614,7 @@ export namespace CoreNavigationCommands {
value: 1
},
id: 'cursorUpSelect',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -633,7 +633,7 @@ export namespace CoreNavigationCommands {
value: Constants.PAGE_SIZE_MARKER
},
id: 'cursorPageUp',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -649,7 +649,7 @@ export namespace CoreNavigationCommands {
value: Constants.PAGE_SIZE_MARKER
},
id: 'cursorPageUpSelect',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -665,7 +665,7 @@ export namespace CoreNavigationCommands {
value: 1
},
id: 'cursorDown',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -682,7 +682,7 @@ export namespace CoreNavigationCommands {
value: 1
},
id: 'cursorDownSelect',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -701,7 +701,7 @@ export namespace CoreNavigationCommands {
value: Constants.PAGE_SIZE_MARKER
},
id: 'cursorPageDown',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -717,7 +717,7 @@ export namespace CoreNavigationCommands {
value: Constants.PAGE_SIZE_MARKER
},
id: 'cursorPageDownSelect',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -729,7 +729,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'createCursor',
precondition: undefined
precondition: null
});
}
@@ -790,7 +790,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: '_lastCursorMoveToSelect',
precondition: undefined
precondition: null
});
}
@@ -835,7 +835,7 @@ export namespace CoreNavigationCommands {
export const CursorHome: CoreEditorCommand = registerEditorCommand(new HomeCommand({
inSelectionMode: false,
id: 'cursorHome',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -847,7 +847,7 @@ export namespace CoreNavigationCommands {
export const CursorHomeSelect: CoreEditorCommand = registerEditorCommand(new HomeCommand({
inSelectionMode: true,
id: 'cursorHomeSelect',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -860,7 +860,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'cursorLineStart',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -914,7 +914,7 @@ export namespace CoreNavigationCommands {
export const CursorEnd: CoreEditorCommand = registerEditorCommand(new EndCommand({
inSelectionMode: false,
id: 'cursorEnd',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -926,7 +926,7 @@ export namespace CoreNavigationCommands {
export const CursorEndSelect: CoreEditorCommand = registerEditorCommand(new EndCommand({
inSelectionMode: true,
id: 'cursorEndSelect',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -939,7 +939,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'cursorLineEnd',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -994,7 +994,7 @@ export namespace CoreNavigationCommands {
export const CursorTop: CoreEditorCommand = registerEditorCommand(new TopCommand({
inSelectionMode: false,
id: 'cursorTop',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -1006,7 +1006,7 @@ export namespace CoreNavigationCommands {
export const CursorTopSelect: CoreEditorCommand = registerEditorCommand(new TopCommand({
inSelectionMode: true,
id: 'cursorTopSelect',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -1038,7 +1038,7 @@ export namespace CoreNavigationCommands {
export const CursorBottom: CoreEditorCommand = registerEditorCommand(new BottomCommand({
inSelectionMode: false,
id: 'cursorBottom',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -1050,7 +1050,7 @@ export namespace CoreNavigationCommands {
export const CursorBottomSelect: CoreEditorCommand = registerEditorCommand(new BottomCommand({
inSelectionMode: true,
id: 'cursorBottomSelect',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -1063,7 +1063,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'editorScroll',
precondition: undefined,
precondition: null,
description: EditorScroll_.description
});
}
@@ -1134,7 +1134,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'scrollLineUp',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -1159,7 +1159,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'scrollPageUp',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -1185,7 +1185,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'scrollLineDown',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -1210,7 +1210,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'scrollPageDown',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -1257,20 +1257,20 @@ export namespace CoreNavigationCommands {
export const WordSelect: CoreEditorCommand = registerEditorCommand(new WordCommand({
inSelectionMode: false,
id: '_wordSelect',
precondition: undefined
precondition: null
}));
export const WordSelectDrag: CoreEditorCommand = registerEditorCommand(new WordCommand({
inSelectionMode: true,
id: '_wordSelectDrag',
precondition: undefined
precondition: null
}));
export const LastCursorWordSelect: CoreEditorCommand = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: 'lastCursorWordSelect',
precondition: undefined
precondition: null
});
}
@@ -1317,13 +1317,13 @@ export namespace CoreNavigationCommands {
export const LineSelect: CoreEditorCommand = registerEditorCommand(new LineCommand({
inSelectionMode: false,
id: '_lineSelect',
precondition: undefined
precondition: null
}));
export const LineSelectDrag: CoreEditorCommand = registerEditorCommand(new LineCommand({
inSelectionMode: true,
id: '_lineSelectDrag',
precondition: undefined
precondition: null
}));
class LastCursorLineCommand extends CoreEditorCommand {
@@ -1353,20 +1353,20 @@ export namespace CoreNavigationCommands {
export const LastCursorLineSelect: CoreEditorCommand = registerEditorCommand(new LastCursorLineCommand({
inSelectionMode: false,
id: 'lastCursorLineSelect',
precondition: undefined
precondition: null
}));
export const LastCursorLineSelectDrag: CoreEditorCommand = registerEditorCommand(new LastCursorLineCommand({
inSelectionMode: true,
id: 'lastCursorLineSelectDrag',
precondition: undefined
precondition: null
}));
export const ExpandLineSelection: CoreEditorCommand = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: 'expandLineSelection',
precondition: undefined,
precondition: null,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
@@ -1445,7 +1445,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'revealLine',
precondition: undefined,
precondition: null,
description: RevealLine_.description
});
}
@@ -1493,7 +1493,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'selectAll',
precondition: undefined
precondition: null
});
}
@@ -1513,7 +1513,7 @@ export namespace CoreNavigationCommands {
constructor() {
super({
id: 'setSelection',
precondition: undefined
precondition: null
});
}
@@ -1728,7 +1728,7 @@ class EditorHandlerCommand extends Command {
constructor(id: string, handlerId: string, description?: ICommandHandlerDescription) {
super({
id: id,
precondition: undefined,
precondition: null,
description: description
});
this._handlerId = handlerId;

View File

@@ -40,17 +40,17 @@ export interface ICommandMenubarOptions {
}
export interface ICommandOptions {
id: string;
precondition: ContextKeyExpr | undefined;
kbOpts?: ICommandKeybindingsOptions;
precondition: ContextKeyExpr | null;
kbOpts?: ICommandKeybindingsOptions | null;
description?: ICommandHandlerDescription;
menubarOpts?: ICommandMenubarOptions;
}
export abstract class Command {
public readonly id: string;
public readonly precondition: ContextKeyExpr | undefined;
private readonly _kbOpts: ICommandKeybindingsOptions | undefined;
private readonly _menubarOpts: ICommandMenubarOptions | undefined;
private readonly _description: ICommandHandlerDescription | undefined;
public readonly precondition: ContextKeyExpr | null;
private readonly _kbOpts: ICommandKeybindingsOptions | null | undefined;
private readonly _menubarOpts: ICommandMenubarOptions | null | undefined;
private readonly _description: ICommandHandlerDescription | null | undefined;
constructor(opts: ICommandOptions) {
this.id = opts.id;

View File

@@ -19,11 +19,14 @@ export function getIconClasses(modelService: IModelService, modeService: IModeSe
// Get the path and name of the resource. For data-URIs, we need to parse specially
let name: string | undefined;
let path: string | undefined;
if (resource.scheme === Schemas.data) {
const metadata = DataUri.parseMetaData(resource);
name = metadata.get(DataUri.META_DATA_LABEL);
path = name;
} else {
name = cssEscape(basenameOrAuthority(resource).toLowerCase());
path = resource.path.toLowerCase();
}
// Folders
@@ -44,60 +47,46 @@ export function getIconClasses(modelService: IModelService, modeService: IModeSe
classes.push(`ext-file-icon`); // extra segment to increase file-ext score
}
// Detected Mode
const detectedModeId = detectModeId(modelService, modeService, resource);
if (detectedModeId) {
classes.push(`${cssEscape(detectedModeId)}-lang-file-icon`);
// Configured Language
let configuredLangId: string | null = getConfiguredLangId(modelService, modeService, resource);
configuredLangId = configuredLangId || (path ? modeService.getModeIdByFilepathOrFirstLine(path) : null);
if (configuredLangId) {
classes.push(`${cssEscape(configuredLangId)}-lang-file-icon`);
}
}
}
return classes;
}
export function detectModeId(modelService: IModelService, modeService: IModeService, resource: uri): string | null {
if (!resource) {
return null; // we need a resource at least
}
export function getConfiguredLangId(modelService: IModelService, modeService: IModeService, resource: uri): string | null {
let configuredLangId: string | null = null;
if (resource) {
let modeId: string | null = null;
let modeId: string | null = null;
// Data URI: check for encoded metadata
if (resource.scheme === Schemas.data) {
const metadata = DataUri.parseMetaData(resource);
const mime = metadata.get(DataUri.META_DATA_MIME);
// Data URI: check for encoded metadata
if (resource.scheme === Schemas.data) {
const metadata = DataUri.parseMetaData(resource);
const mime = metadata.get(DataUri.META_DATA_MIME);
if (mime) {
modeId = modeService.getModeId(mime);
}
}
if (mime) {
modeId = modeService.getModeId(mime);
// Any other URI: check for model if existing
else {
const model = modelService.getModel(resource);
if (model) {
modeId = model.getLanguageIdentifier().language;
}
}
if (modeId && modeId !== PLAINTEXT_MODE_ID) {
configuredLangId = modeId; // only take if the mode is specific (aka no just plain text)
}
}
// Any other URI: check for model if existing
else {
const model = modelService.getModel(resource);
if (model) {
modeId = model.getModeId();
}
}
// only take if the mode is specific (aka no just plain text)
if (modeId && modeId !== PLAINTEXT_MODE_ID) {
return modeId;
}
// otherwise fallback to path based detection
let path: string | undefined;
if (resource.scheme === Schemas.data) {
const metadata = DataUri.parseMetaData(resource);
path = metadata.get(DataUri.META_DATA_LABEL);
} else {
path = resource.path.toLowerCase();
}
if (path) {
return modeService.getModeIdByFilepathOrFirstLine(path);
}
return null; // finally - we do not know the mode id
return configuredLangId;
}
export function cssEscape(val: string): string {

View File

@@ -5,7 +5,7 @@
import { IDisposable, IReference } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { ITextModel, ITextSnapshot } from 'vs/editor/common/model';
import { ITextModel } from 'vs/editor/common/model';
import { IEditorModel } from 'vs/platform/editor/common/editor';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
@@ -46,12 +46,6 @@ export interface ITextEditorModel extends IEditorModel {
*/
readonly textEditorModel: ITextModel | null;
/**
* Creates a snapshot of the model's contents.
*/
createSnapshot(this: IResolvedTextEditorModel): ITextSnapshot;
createSnapshot(this: ITextEditorModel): ITextSnapshot | null;
isReadonly(): boolean;
}

View File

@@ -31,7 +31,7 @@ class JumpToBracketAction extends EditorAction {
id: 'editor.action.jumpToBracket',
label: nls.localize('smartSelect.jumpBracket', "Go to Bracket"),
alias: 'Go to Bracket',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_BACKSLASH,
@@ -55,7 +55,7 @@ class SelectToBracketAction extends EditorAction {
id: 'editor.action.selectToBracket',
label: nls.localize('smartSelect.selectToBracket', "Select to Bracket"),
alias: 'Select to Bracket',
precondition: undefined
precondition: null
});
}

View File

@@ -59,7 +59,7 @@ abstract class ExecCommandAction extends EditorAction {
class ExecCommandCutAction extends ExecCommandAction {
constructor() {
let kbOpts: ICommandKeybindingsOptions | undefined = {
let kbOpts: ICommandKeybindingsOptions | null = {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.KEY_X,
win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_X, secondary: [KeyMod.Shift | KeyCode.Delete] },
@@ -68,7 +68,7 @@ class ExecCommandCutAction extends ExecCommandAction {
// Do not bind cut keybindings in the browser,
// since browsers do that for us and it avoids security prompts
if (!platform.isNative) {
kbOpts = undefined;
kbOpts = null;
}
super('cut', {
id: 'editor.action.clipboardCutAction',
@@ -107,7 +107,7 @@ class ExecCommandCutAction extends ExecCommandAction {
class ExecCommandCopyAction extends ExecCommandAction {
constructor() {
let kbOpts: ICommandKeybindingsOptions | undefined = {
let kbOpts: ICommandKeybindingsOptions | null = {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.KEY_C,
win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_C, secondary: [KeyMod.CtrlCmd | KeyCode.Insert] },
@@ -116,14 +116,14 @@ class ExecCommandCopyAction extends ExecCommandAction {
// Do not bind copy keybindings in the browser,
// since browsers do that for us and it avoids security prompts
if (!platform.isNative) {
kbOpts = undefined;
kbOpts = null;
}
super('copy', {
id: 'editor.action.clipboardCopyAction',
label: nls.localize('actions.clipboard.copyLabel', "Copy"),
alias: 'Copy',
precondition: undefined,
precondition: null,
kbOpts: kbOpts,
menuOpts: {
group: CLIPBOARD_CONTEXT_MENU_GROUP,
@@ -162,7 +162,7 @@ class ExecCommandCopyAction extends ExecCommandAction {
class ExecCommandPasteAction extends ExecCommandAction {
constructor() {
let kbOpts: ICommandKeybindingsOptions | undefined = {
let kbOpts: ICommandKeybindingsOptions | null = {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.KEY_V,
win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_V, secondary: [KeyMod.Shift | KeyCode.Insert] },
@@ -171,7 +171,7 @@ class ExecCommandPasteAction extends ExecCommandAction {
// Do not bind paste keybindings in the browser,
// since browsers do that for us and it avoids security prompts
if (!platform.isNative) {
kbOpts = undefined;
kbOpts = null;
}
super('paste', {
@@ -201,7 +201,7 @@ class ExecCommandCopyWithSyntaxHighlightingAction extends ExecCommandAction {
id: 'editor.action.clipboardCopyWithSyntaxHighlightingAction',
label: nls.localize('actions.clipboard.copyWithSyntaxHighlightingLabel', "Copy With Syntax Highlighting"),
alias: 'Copy With Syntax Highlighting',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: 0,

View File

@@ -34,8 +34,8 @@ export class CodeActionSet {
public readonly actions: readonly CodeAction[];
public constructor(actions: readonly CodeAction[]) {
this.actions = mergeSort([...actions], CodeActionSet.codeActionsComparator);
public constructor(actions: CodeAction[]) {
this.actions = mergeSort(actions, CodeActionSet.codeActionsComparator);
}
public get hasAutoFix() {

View File

@@ -176,7 +176,6 @@ function showCodeActionsForEditorSelection(
return;
}
MessageController.get(editor).closeMessage();
const pos = editor.getPosition();
controller.triggerFromEditorSelection(filter, autoApply).then(codeActions => {
if (!codeActions || !codeActions.actions.length) {

View File

@@ -20,12 +20,8 @@ export class CodeActionKind {
public readonly value: string
) { }
public equals(other: CodeActionKind): boolean {
return this.value === other.value;
}
public contains(other: CodeActionKind): boolean {
return this.equals(other) || startsWith(other.value, this.value + CodeActionKind.sep);
return this.value === other.value || startsWith(other.value, this.value + CodeActionKind.sep);
}
public intersects(other: CodeActionKind): boolean {

View File

@@ -76,9 +76,9 @@ export class ColorDetector implements IEditorContribution {
}
const languageId = model.getLanguageIdentifier();
// handle deprecated settings. [languageId].colorDecorators.enable
const deprecatedConfig = this._configurationService.getValue<{}>(languageId.language);
let deprecatedConfig = this._configurationService.getValue(languageId.language);
if (deprecatedConfig) {
const colorDecorators = deprecatedConfig['colorDecorators']; // deprecatedConfig.valueOf('.colorDecorators.enable');
let colorDecorators = deprecatedConfig['colorDecorators']; // deprecatedConfig.valueOf('.colorDecorators.enable');
if (colorDecorators && colorDecorators['enable'] !== undefined && !colorDecorators['enable']) {
return colorDecorators['enable'];
}

View File

@@ -6,7 +6,7 @@
import * as nls from 'vs/nls';
import * as dom from 'vs/base/browser/dom';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { ActionViewItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { IAnchor } from 'vs/base/browser/ui/contextview/contextview';
import { IAction } from 'vs/base/common/actions';
import { KeyCode, KeyMod, ResolvedKeybinding } from 'vs/base/common/keyCodes';
@@ -176,18 +176,18 @@ export class ContextMenuController implements IEditorContribution {
getActions: () => actions,
getActionViewItem: (action) => {
getActionItem: (action) => {
const keybinding = this._keybindingFor(action);
if (keybinding) {
return new ActionViewItem(action, action, { label: true, keybinding: keybinding.getLabel(), isMenu: true });
return new ActionItem(action, action, { label: true, keybinding: keybinding.getLabel(), isMenu: true });
}
const customActionViewItem = <any>action;
if (typeof customActionViewItem.getActionViewItem === 'function') {
return customActionViewItem.getActionViewItem();
const customActionItem = <any>action;
if (typeof customActionItem.getActionItem === 'function') {
return customActionItem.getActionItem();
}
return new ActionViewItem(action, action, { icon: true, label: true, isMenu: true });
return new ActionItem(action, action, { icon: true, label: true, isMenu: true });
},
getKeyBinding: (action): ResolvedKeybinding | undefined => {
@@ -228,7 +228,7 @@ class ShowContextMenu extends EditorAction {
id: 'editor.action.showContextMenu',
label: nls.localize('action.showContextMenu.label', "Show Editor Context Menu"),
alias: 'Show Editor Context Menu',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.Shift | KeyCode.F10,

View File

@@ -119,7 +119,7 @@ export class CursorUndo extends EditorAction {
id: 'cursorUndo',
label: nls.localize('cursor.undo', "Soft Undo"),
alias: 'Soft Undo',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.KEY_U,

View File

@@ -422,7 +422,7 @@ export class StartFindAction extends EditorAction {
id: FIND_IDS.StartFindAction,
label: nls.localize('startFindAction', "Find"),
alias: 'Find',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: null,
primary: KeyMod.CtrlCmd | KeyCode.KEY_F,
@@ -459,7 +459,7 @@ export class StartFindWithSelectionAction extends EditorAction {
id: FIND_IDS.StartFindWithSelection,
label: nls.localize('startFindWithSelectionAction', "Find With Selection"),
alias: 'Find With Selection',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: null,
primary: 0,
@@ -513,7 +513,7 @@ export class NextMatchFindAction extends MatchFindAction {
id: FIND_IDS.NextMatchFindAction,
label: nls.localize('findNextMatchAction', "Find Next"),
alias: 'Find Next',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.focus,
primary: KeyCode.F3,
@@ -535,7 +535,7 @@ export class PreviousMatchFindAction extends MatchFindAction {
id: FIND_IDS.PreviousMatchFindAction,
label: nls.localize('findPreviousMatchAction', "Find Previous"),
alias: 'Find Previous',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.focus,
primary: KeyMod.Shift | KeyCode.F3,
@@ -583,7 +583,7 @@ export class NextSelectionMatchFindAction extends SelectionMatchFindAction {
id: FIND_IDS.NextSelectionMatchFindAction,
label: nls.localize('nextSelectionMatchFindAction', "Find Next Selection"),
alias: 'Find Next Selection',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.focus,
primary: KeyMod.CtrlCmd | KeyCode.F3,
@@ -604,7 +604,7 @@ export class PreviousSelectionMatchFindAction extends SelectionMatchFindAction {
id: FIND_IDS.PreviousSelectionMatchFindAction,
label: nls.localize('previousSelectionMatchFindAction', "Find Previous Selection"),
alias: 'Find Previous Selection',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.focus,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F3,
@@ -625,7 +625,7 @@ export class StartFindReplaceAction extends EditorAction {
id: FIND_IDS.StartFindReplaceAction,
label: nls.localize('startReplace', "Replace"),
alias: 'Replace',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: null,
primary: KeyMod.CtrlCmd | KeyCode.KEY_H,
@@ -704,7 +704,7 @@ registerEditorCommand(new FindCommand({
registerEditorCommand(new FindCommand({
id: FIND_IDS.ToggleCaseSensitiveCommand,
precondition: undefined,
precondition: null,
handler: x => x.toggleCaseSensitive(),
kbOpts: {
weight: KeybindingWeight.EditorContrib + 5,
@@ -718,7 +718,7 @@ registerEditorCommand(new FindCommand({
registerEditorCommand(new FindCommand({
id: FIND_IDS.ToggleWholeWordCommand,
precondition: undefined,
precondition: null,
handler: x => x.toggleWholeWords(),
kbOpts: {
weight: KeybindingWeight.EditorContrib + 5,
@@ -732,7 +732,7 @@ registerEditorCommand(new FindCommand({
registerEditorCommand(new FindCommand({
id: FIND_IDS.ToggleRegexCommand,
precondition: undefined,
precondition: null,
handler: x => x.toggleRegex(),
kbOpts: {
weight: KeybindingWeight.EditorContrib + 5,
@@ -746,7 +746,7 @@ registerEditorCommand(new FindCommand({
registerEditorCommand(new FindCommand({
id: FIND_IDS.ToggleSearchScopeCommand,
precondition: undefined,
precondition: null,
handler: x => x.toggleSearchScope(),
kbOpts: {
weight: KeybindingWeight.EditorContrib + 5,

View File

@@ -503,7 +503,7 @@ class UnfoldAction extends FoldingAction<FoldingArguments> {
id: 'editor.unfold',
label: nls.localize('unfoldAction.label', "Unfold"),
alias: 'Unfold',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_CLOSE_SQUARE_BRACKET,
@@ -567,7 +567,7 @@ class UnFoldRecursivelyAction extends FoldingAction<void> {
id: 'editor.unfoldRecursively',
label: nls.localize('unFoldRecursivelyAction.label', "Unfold Recursively"),
alias: 'Unfold Recursively',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET),
@@ -588,7 +588,7 @@ class FoldAction extends FoldingAction<FoldingArguments> {
id: 'editor.fold',
label: nls.localize('foldAction.label', "Fold"),
alias: 'Fold',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_OPEN_SQUARE_BRACKET,
@@ -652,7 +652,7 @@ class FoldRecursivelyAction extends FoldingAction<void> {
id: 'editor.foldRecursively',
label: nls.localize('foldRecursivelyAction.label', "Fold Recursively"),
alias: 'Fold Recursively',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET),
@@ -674,7 +674,7 @@ class FoldAllBlockCommentsAction extends FoldingAction<void> {
id: 'editor.foldAllBlockComments',
label: nls.localize('foldAllBlockComments.label', "Fold All Block Comments"),
alias: 'Fold All Block Comments',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_SLASH),
@@ -707,7 +707,7 @@ class FoldAllRegionsAction extends FoldingAction<void> {
id: 'editor.foldAllMarkerRegions',
label: nls.localize('foldAllMarkerRegions.label', "Fold All Regions"),
alias: 'Fold All Regions',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_8),
@@ -740,7 +740,7 @@ class UnfoldAllRegionsAction extends FoldingAction<void> {
id: 'editor.unfoldAllMarkerRegions',
label: nls.localize('unfoldAllMarkerRegions.label', "Unfold All Regions"),
alias: 'Unfold All Regions',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_9),
@@ -773,7 +773,7 @@ class FoldAllAction extends FoldingAction<void> {
id: 'editor.foldAll',
label: nls.localize('foldAllAction.label', "Fold All"),
alias: 'Fold All',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_0),
@@ -794,7 +794,7 @@ class UnfoldAllAction extends FoldingAction<void> {
id: 'editor.unfoldAll',
label: nls.localize('unfoldAllAction.label', "Unfold All"),
alias: 'Unfold All',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_J),
@@ -838,7 +838,7 @@ for (let i = 1; i <= 7; i++) {
id: FoldLevelAction.ID(i),
label: nls.localize('foldLevelAction.label', "Fold Level {0}", i),
alias: `Fold Level ${i}`,
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | (KeyCode.KEY_0 + i)),

View File

@@ -15,7 +15,7 @@ class EditorFontZoomIn extends EditorAction {
id: 'editor.action.fontZoomIn',
label: nls.localize('EditorFontZoomIn.label', "Editor Font Zoom In"),
alias: 'Editor Font Zoom In',
precondition: undefined
precondition: null
});
}
@@ -31,7 +31,7 @@ class EditorFontZoomOut extends EditorAction {
id: 'editor.action.fontZoomOut',
label: nls.localize('EditorFontZoomOut.label', "Editor Font Zoom Out"),
alias: 'Editor Font Zoom Out',
precondition: undefined
precondition: null
});
}
@@ -47,7 +47,7 @@ class EditorFontZoomReset extends EditorAction {
id: 'editor.action.fontZoomReset',
label: nls.localize('EditorFontZoomReset.label', "Editor Font Zoom Reset"),
alias: 'Editor Font Zoom Reset',
precondition: undefined
precondition: null
});
}

View File

@@ -294,7 +294,7 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
private gotoDefinition(target: IMouseTarget, sideBySide: boolean): Promise<any> {
this.editor.setPosition(target.position!);
const action = new DefinitionAction(new DefinitionActionConfig(sideBySide, false, true, false), { alias: '', label: '', id: '', precondition: undefined });
const action = new DefinitionAction(new DefinitionActionConfig(sideBySide, false, true, false), { alias: '', label: '', id: '', precondition: null });
return this.editor.invokeWithinContext(accessor => action.run(accessor, this.editor));
}

View File

@@ -251,7 +251,7 @@ class ShowHoverAction extends EditorAction {
]
}, "Show Hover"),
alias: 'Show Hover',
precondition: undefined,
precondition: null,
kbOpts: {
kbExpr: EditorContextKeys.editorTextFocus,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I),

View File

@@ -40,6 +40,7 @@ import { applyCodeAction, QuickFixAction } from 'vs/editor/contrib/codeAction/co
import { Action } from 'vs/base/common/actions';
import { CodeActionKind } from 'vs/editor/contrib/codeAction/codeActionTrigger';
import { IModeService } from 'vs/editor/common/services/modeService';
import { withNullAsUndefined } from 'vs/base/common/types';
import { IIdentifiedSingleEditOperation } from 'vs/editor/common/model';
const $ = dom.$;
@@ -67,13 +68,14 @@ class ModesContentComputer implements IHoverComputer<HoverPart[]> {
private readonly _editor: ICodeEditor;
private _result: HoverPart[];
private _range?: Range;
private _range: Range | null;
constructor(
editor: ICodeEditor,
private readonly _markerDecorationsService: IMarkerDecorationsService
) {
this._editor = editor;
this._range = null;
}
setRange(range: Range): void {
@@ -181,7 +183,7 @@ class ModesContentComputer implements IHoverComputer<HoverPart[]> {
private _getLoadingMessage(): HoverPart {
return {
range: this._range,
range: withNullAsUndefined(this._range),
contents: [new MarkdownString().appendText(nls.localize('modesContentHover.loading', "Loading..."))]
};
}

View File

@@ -253,7 +253,7 @@ export class IndentUsingTabs extends ChangeIndentationSizeAction {
id: IndentUsingTabs.ID,
label: nls.localize('indentUsingTabs', "Indent Using Tabs"),
alias: 'Indent Using Tabs',
precondition: undefined
precondition: null
});
}
}
@@ -267,7 +267,7 @@ export class IndentUsingSpaces extends ChangeIndentationSizeAction {
id: IndentUsingSpaces.ID,
label: nls.localize('indentUsingSpaces', "Indent Using Spaces"),
alias: 'Indent Using Spaces',
precondition: undefined
precondition: null
});
}
}
@@ -281,7 +281,7 @@ export class DetectIndentation extends EditorAction {
id: DetectIndentation.ID,
label: nls.localize('detectIndentation', "Detect Indentation from Content"),
alias: 'Detect Indentation from Content',
precondition: undefined
precondition: null
});
}

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