mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Merge remote-tracking branch 'origin/master' into pr/jasongin/80293
This commit is contained in:
@@ -44,6 +44,8 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
const root = path.join('extensions', relativeDirname);
|
||||
const srcBase = path.join(root, 'src');
|
||||
const src = path.join(srcBase, '**');
|
||||
const srcOpts = { cwd: path.dirname(__dirname), base: srcBase };
|
||||
|
||||
const out = path.join(root, 'out');
|
||||
const baseUrl = getBaseUrl(out);
|
||||
|
||||
@@ -65,7 +67,7 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
|
||||
const compilation = tsb.create(absolutePath, overrideOptions, false, err => reporter(err.toString()));
|
||||
|
||||
return function () {
|
||||
const pipeline = function () {
|
||||
const input = es.through();
|
||||
const tsFilter = filter(['**/*.ts', '!**/lib/lib*.d.ts', '!**/node_modules/**'], { restore: true });
|
||||
const output = input
|
||||
@@ -95,15 +97,19 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
|
||||
return es.duplex(input, output);
|
||||
};
|
||||
}
|
||||
|
||||
const srcOpts = { cwd: path.dirname(__dirname), base: srcBase };
|
||||
// add src-stream for project files
|
||||
pipeline.tsProjectSrc = () => {
|
||||
return compilation.src(srcOpts);
|
||||
};
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
const cleanTask = task.define(`clean-extension-${name}`, util.rimraf(out));
|
||||
|
||||
const compileTask = task.define(`compile-extension:${name}`, task.series(cleanTask, () => {
|
||||
const pipeline = createPipeline(false, true);
|
||||
const input = gulp.src(src, srcOpts);
|
||||
const input = pipeline.tsProjectSrc();
|
||||
|
||||
return input
|
||||
.pipe(pipeline())
|
||||
@@ -112,8 +118,8 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
|
||||
const watchTask = task.define(`watch-extension:${name}`, task.series(cleanTask, () => {
|
||||
const pipeline = createPipeline(false);
|
||||
const input = gulp.src(src, srcOpts);
|
||||
const watchInput = watcher(src, srcOpts);
|
||||
const input = pipeline.tsProjectSrc();
|
||||
const watchInput = watcher(src, { ...srcOpts, ...{ readDelay: 200 } });
|
||||
|
||||
return watchInput
|
||||
.pipe(util.incremental(pipeline, input))
|
||||
@@ -122,7 +128,7 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
|
||||
const compileBuildTask = task.define(`compile-build-extension-${name}`, task.series(cleanTask, () => {
|
||||
const pipeline = createPipeline(true, true);
|
||||
const input = gulp.src(src, srcOpts);
|
||||
const input = pipeline.tsProjectSrc();
|
||||
|
||||
return input
|
||||
.pipe(pipeline())
|
||||
|
||||
@@ -93,6 +93,7 @@ const optimizeVSCodeTask = task.define('optimize-vscode', task.series(
|
||||
resources: vscodeResources,
|
||||
loaderConfig: common.loaderConfig(nodeModules),
|
||||
out: 'out-vscode',
|
||||
inlineAmdImages: true,
|
||||
bundleInfo: undefined
|
||||
})
|
||||
));
|
||||
|
||||
@@ -42,6 +42,7 @@ function prepareDebPackage(arch) {
|
||||
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
||||
.pipe(replace('@@NAME_SHORT@@', product.nameShort))
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(replace('@@EXEC@@', `/usr/share/${product.applicationName}/${product.applicationName}`))
|
||||
.pipe(replace('@@ICON@@', product.linuxIconName))
|
||||
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));
|
||||
|
||||
@@ -134,6 +135,7 @@ function prepareRpmPackage(arch) {
|
||||
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
||||
.pipe(replace('@@NAME_SHORT@@', product.nameShort))
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(replace('@@EXEC@@', `/usr/share/${product.applicationName}/${product.applicationName}`))
|
||||
.pipe(replace('@@ICON@@', product.linuxIconName))
|
||||
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));
|
||||
|
||||
@@ -203,21 +205,25 @@ function prepareSnapPackage(arch) {
|
||||
const destination = getSnapBuildPath(arch);
|
||||
|
||||
return function () {
|
||||
// A desktop file that is placed in snap/gui will be placed into meta/gui verbatim.
|
||||
const desktop = gulp.src('resources/linux/code.desktop', { base: '.' })
|
||||
.pipe(rename(`usr/share/applications/${product.applicationName}.desktop`));
|
||||
.pipe(rename(`snap/gui/${product.applicationName}.desktop`));
|
||||
|
||||
// A desktop file that is placed in snap/gui will be placed into meta/gui verbatim.
|
||||
const desktopUrlHandler = gulp.src('resources/linux/code-url-handler.desktop', { base: '.' })
|
||||
.pipe(rename(`usr/share/applications/${product.applicationName}-url-handler.desktop`));
|
||||
.pipe(rename(`snap/gui/${product.applicationName}-url-handler.desktop`));
|
||||
|
||||
const desktops = es.merge(desktop, desktopUrlHandler)
|
||||
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
||||
.pipe(replace('@@NAME_SHORT@@', product.nameShort))
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(replace('@@ICON@@', `/usr/share/pixmaps/${product.linuxIconName}.png`))
|
||||
.pipe(replace('@@EXEC@@', product.applicationName))
|
||||
.pipe(replace('@@ICON@@', `\${SNAP}/meta/gui/${product.linuxIconName}.png`))
|
||||
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));
|
||||
|
||||
// An icon that is placed in snap/gui will be placed into meta/gui verbatim.
|
||||
const icon = gulp.src('resources/linux/code.png', { base: '.' })
|
||||
.pipe(rename(`usr/share/pixmaps/${product.linuxIconName}.png`));
|
||||
.pipe(rename(`snap/gui/${product.linuxIconName}.png`));
|
||||
|
||||
const code = gulp.src(binaryDir + '/**/*', { base: binaryDir })
|
||||
.pipe(rename(function (p) { p.dirname = `usr/share/${product.applicationName}/${p.dirname}`; }));
|
||||
@@ -238,7 +244,8 @@ function prepareSnapPackage(arch) {
|
||||
|
||||
function buildSnapPackage(arch) {
|
||||
const snapBuildPath = getSnapBuildPath(arch);
|
||||
return shell.task(`cd ${snapBuildPath} && snapcraft build`);
|
||||
// Default target for snapcraft runs: pull, build, stage and prime, and finally assembles the snap.
|
||||
return shell.task(`cd ${snapBuildPath} && snapcraft`);
|
||||
}
|
||||
|
||||
const BUILD_TARGETS = [
|
||||
|
||||
@@ -34,7 +34,8 @@ const nodeModules = Object.keys(product.dependencies || {})
|
||||
const vscodeWebResources = [
|
||||
|
||||
// Workbench
|
||||
'out-build/vs/{base,platform,editor,workbench}/**/*.{svg,png,html}',
|
||||
'out-build/vs/{base,platform,editor,workbench}/**/*.{svg,png}',
|
||||
'out-build/vs/code/browser/workbench/*.html',
|
||||
'out-build/vs/base/browser/ui/octiconLabel/octicons/**',
|
||||
'out-build/vs/**/markdown.css',
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ function getTypeScriptCompilerOptions(src) {
|
||||
function createCompile(src, build, emitError) {
|
||||
const projectPath = path.join(__dirname, '../../', src, 'tsconfig.json');
|
||||
const overrideOptions = Object.assign(Object.assign({}, getTypeScriptCompilerOptions(src)), { inlineSources: Boolean(build) });
|
||||
const ts = tsb.create(projectPath, overrideOptions, false, err => reporter(err));
|
||||
return function (token) {
|
||||
const compilation = tsb.create(projectPath, overrideOptions, false, err => reporter(err));
|
||||
function pipeline(token) {
|
||||
const utf8Filter = util.filter(data => /(\/|\\)test(\/|\\).*utf8/.test(data.path));
|
||||
const tsFilter = util.filter(data => /\.ts$/.test(data.path));
|
||||
const noDeclarationsFilter = util.filter(data => !(/\.d\.ts$/.test(data.path)));
|
||||
@@ -48,7 +48,7 @@ function createCompile(src, build, emitError) {
|
||||
.pipe(utf8Filter.restore)
|
||||
.pipe(tsFilter)
|
||||
.pipe(util.loadSourcemaps())
|
||||
.pipe(ts(token))
|
||||
.pipe(compilation(token))
|
||||
.pipe(noDeclarationsFilter)
|
||||
.pipe(build ? nls() : es.through())
|
||||
.pipe(noDeclarationsFilter.restore)
|
||||
@@ -60,7 +60,11 @@ function createCompile(src, build, emitError) {
|
||||
.pipe(tsFilter.restore)
|
||||
.pipe(reporter.end(!!emitError));
|
||||
return es.duplex(input, output);
|
||||
}
|
||||
pipeline.tsProjectSrc = () => {
|
||||
return compilation.src({ base: src });
|
||||
};
|
||||
return pipeline;
|
||||
}
|
||||
function compileTask(src, out, build) {
|
||||
return function () {
|
||||
@@ -81,7 +85,7 @@ function watchTask(out, build) {
|
||||
return function () {
|
||||
const compile = createCompile('src', build);
|
||||
const src = gulp.src('src/**', { base: 'src' });
|
||||
const watchSrc = watch('src/**', { base: 'src' });
|
||||
const watchSrc = watch('src/**', { base: 'src', readDelay: 200 });
|
||||
let generator = new MonacoGenerator(true);
|
||||
generator.execute();
|
||||
return watchSrc
|
||||
|
||||
@@ -39,13 +39,13 @@ function getTypeScriptCompilerOptions(src: string): ts.CompilerOptions {
|
||||
return options;
|
||||
}
|
||||
|
||||
function createCompile(src: string, build: boolean, emitError?: boolean): (token?: util.ICancellationToken) => NodeJS.ReadWriteStream {
|
||||
function createCompile(src: string, build: boolean, emitError?: boolean) {
|
||||
const projectPath = path.join(__dirname, '../../', src, 'tsconfig.json');
|
||||
const overrideOptions = { ...getTypeScriptCompilerOptions(src), inlineSources: Boolean(build) };
|
||||
|
||||
const ts = tsb.create(projectPath, overrideOptions, false, err => reporter(err));
|
||||
const compilation = tsb.create(projectPath, overrideOptions, false, err => reporter(err));
|
||||
|
||||
return function (token?: util.ICancellationToken) {
|
||||
function pipeline(token?: util.ICancellationToken) {
|
||||
|
||||
const utf8Filter = util.filter(data => /(\/|\\)test(\/|\\).*utf8/.test(data.path));
|
||||
const tsFilter = util.filter(data => /\.ts$/.test(data.path));
|
||||
@@ -58,7 +58,7 @@ function createCompile(src: string, build: boolean, emitError?: boolean): (token
|
||||
.pipe(utf8Filter.restore)
|
||||
.pipe(tsFilter)
|
||||
.pipe(util.loadSourcemaps())
|
||||
.pipe(ts(token))
|
||||
.pipe(compilation(token))
|
||||
.pipe(noDeclarationsFilter)
|
||||
.pipe(build ? nls() : es.through())
|
||||
.pipe(noDeclarationsFilter.restore)
|
||||
@@ -71,16 +71,18 @@ function createCompile(src: string, build: boolean, emitError?: boolean): (token
|
||||
.pipe(reporter.end(!!emitError));
|
||||
|
||||
return es.duplex(input, output);
|
||||
}
|
||||
pipeline.tsProjectSrc = () => {
|
||||
return compilation.src({ base: src });
|
||||
};
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
export function compileTask(src: string, out: string, build: boolean): () => NodeJS.ReadWriteStream {
|
||||
|
||||
return function () {
|
||||
const compile = createCompile(src, build, true);
|
||||
|
||||
const srcPipe = gulp.src(`${src}/**`, { base: `${src}` });
|
||||
|
||||
let generator = new MonacoGenerator(false);
|
||||
if (src === 'src') {
|
||||
generator.execute();
|
||||
@@ -99,7 +101,7 @@ export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteSt
|
||||
const compile = createCompile('src', build);
|
||||
|
||||
const src = gulp.src('src/**', { base: 'src' });
|
||||
const watchSrc = watch('src/**', { base: 'src' });
|
||||
const watchSrc = watch('src/**', { base: 'src', readDelay: 200 });
|
||||
|
||||
let generator = new MonacoGenerator(true);
|
||||
generator.execute();
|
||||
|
||||
+42
-3
@@ -5,6 +5,7 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const es = require("event-stream");
|
||||
const fs = require("fs");
|
||||
const gulp = require("gulp");
|
||||
const concat = require("gulp-concat");
|
||||
const minifyCSS = require("gulp-cssnano");
|
||||
@@ -132,6 +133,14 @@ function optimizeTask(opts) {
|
||||
if (err || !result) {
|
||||
return bundlesStream.emit('error', JSON.stringify(err));
|
||||
}
|
||||
if (opts.inlineAmdImages) {
|
||||
try {
|
||||
result = inlineAmdImages(src, result);
|
||||
}
|
||||
catch (err) {
|
||||
return bundlesStream.emit('error', JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
toBundleStream(src, bundledFileHeader, result.files).pipe(bundlesStream);
|
||||
// Remove css inlined resources
|
||||
const filteredResources = resources.slice();
|
||||
@@ -167,6 +176,39 @@ function optimizeTask(opts) {
|
||||
};
|
||||
}
|
||||
exports.optimizeTask = optimizeTask;
|
||||
function inlineAmdImages(src, result) {
|
||||
for (const outputFile of result.files) {
|
||||
for (const sourceFile of outputFile.sources) {
|
||||
if (sourceFile.path && /\.js$/.test(sourceFile.path)) {
|
||||
sourceFile.contents = sourceFile.contents.replace(/\([^.]+\.registerAndGetAmdImageURL\(([^)]+)\)\)/g, (_, m0) => {
|
||||
let imagePath = m0;
|
||||
// remove `` or ''
|
||||
if ((imagePath.charAt(0) === '`' && imagePath.charAt(imagePath.length - 1) === '`')
|
||||
|| (imagePath.charAt(0) === '\'' && imagePath.charAt(imagePath.length - 1) === '\'')) {
|
||||
imagePath = imagePath.substr(1, imagePath.length - 2);
|
||||
}
|
||||
if (!/\.(png|svg)$/.test(imagePath)) {
|
||||
console.log(`original: ${_}`);
|
||||
return _;
|
||||
}
|
||||
const repoLocation = path.join(src, imagePath);
|
||||
const absoluteLocation = path.join(REPO_ROOT_PATH, repoLocation);
|
||||
if (!fs.existsSync(absoluteLocation)) {
|
||||
const message = `Invalid amd image url in file ${sourceFile.path}: ${imagePath}`;
|
||||
console.log(message);
|
||||
throw new Error(message);
|
||||
}
|
||||
const fileContents = fs.readFileSync(absoluteLocation);
|
||||
const mime = /\.svg$/.test(imagePath) ? 'image/svg+xml' : 'image/png';
|
||||
// Mark the file as inlined so we don't ship it by itself
|
||||
result.cssInlinedResources.push(repoLocation);
|
||||
return `("data:${mime};base64,${fileContents.toString('base64')}")`;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Wrap around uglify and allow the preserveComments function
|
||||
* to have a file "context" to include our copyright only once per file.
|
||||
@@ -202,9 +244,6 @@ function uglifyWithCopyrights() {
|
||||
const output = input
|
||||
.pipe(flatmap((stream, f) => {
|
||||
return stream.pipe(minify({
|
||||
compress: {
|
||||
hoist_funs: true // required due to https://github.com/microsoft/vscode/issues/80202
|
||||
},
|
||||
output: {
|
||||
comments: preserveComments(f),
|
||||
max_line_len: 1024
|
||||
|
||||
+49
-3
@@ -6,6 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
import * as es from 'event-stream';
|
||||
import * as fs from 'fs';
|
||||
import * as gulp from 'gulp';
|
||||
import * as concat from 'gulp-concat';
|
||||
import * as minifyCSS from 'gulp-cssnano';
|
||||
@@ -159,6 +160,10 @@ export interface IOptimizeTaskOpts {
|
||||
* (emit bundleInfo.json file)
|
||||
*/
|
||||
bundleInfo: boolean;
|
||||
/**
|
||||
* replace calls to `registerAndGetAmdImageURL` with data uris
|
||||
*/
|
||||
inlineAmdImages: boolean;
|
||||
/**
|
||||
* (out folder name)
|
||||
*/
|
||||
@@ -192,6 +197,14 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
|
||||
bundle.bundle(entryPoints, loaderConfig, function (err, result) {
|
||||
if (err || !result) { return bundlesStream.emit('error', JSON.stringify(err)); }
|
||||
|
||||
if (opts.inlineAmdImages) {
|
||||
try {
|
||||
result = inlineAmdImages(src, result);
|
||||
} catch (err) {
|
||||
return bundlesStream.emit('error', JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
|
||||
toBundleStream(src, bundledFileHeader, result.files).pipe(bundlesStream);
|
||||
|
||||
// Remove css inlined resources
|
||||
@@ -236,6 +249,42 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
|
||||
};
|
||||
}
|
||||
|
||||
function inlineAmdImages(src: string, result: bundle.IBundleResult): bundle.IBundleResult {
|
||||
for (const outputFile of result.files) {
|
||||
for (const sourceFile of outputFile.sources) {
|
||||
if (sourceFile.path && /\.js$/.test(sourceFile.path)) {
|
||||
sourceFile.contents = sourceFile.contents.replace(/\([^.]+\.registerAndGetAmdImageURL\(([^)]+)\)\)/g, (_, m0) => {
|
||||
let imagePath = m0;
|
||||
// remove `` or ''
|
||||
if ((imagePath.charAt(0) === '`' && imagePath.charAt(imagePath.length - 1) === '`')
|
||||
|| (imagePath.charAt(0) === '\'' && imagePath.charAt(imagePath.length - 1) === '\'')) {
|
||||
imagePath = imagePath.substr(1, imagePath.length - 2);
|
||||
}
|
||||
if (!/\.(png|svg)$/.test(imagePath)) {
|
||||
console.log(`original: ${_}`);
|
||||
return _;
|
||||
}
|
||||
const repoLocation = path.join(src, imagePath);
|
||||
const absoluteLocation = path.join(REPO_ROOT_PATH, repoLocation);
|
||||
if (!fs.existsSync(absoluteLocation)) {
|
||||
const message = `Invalid amd image url in file ${sourceFile.path}: ${imagePath}`;
|
||||
console.log(message);
|
||||
throw new Error(message);
|
||||
}
|
||||
const fileContents = fs.readFileSync(absoluteLocation);
|
||||
const mime = /\.svg$/.test(imagePath) ? 'image/svg+xml' : 'image/png';
|
||||
|
||||
// Mark the file as inlined so we don't ship it by itself
|
||||
result.cssInlinedResources.push(repoLocation);
|
||||
|
||||
return `("data:${mime};base64,${fileContents.toString('base64')}")`;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
declare class FileWithCopyright extends VinylFile {
|
||||
public __hasOurCopyright: boolean;
|
||||
}
|
||||
@@ -278,9 +327,6 @@ function uglifyWithCopyrights(): NodeJS.ReadWriteStream {
|
||||
const output = input
|
||||
.pipe(flatmap((stream, f) => {
|
||||
return stream.pipe(minify({
|
||||
compress: {
|
||||
hoist_funs: true // required due to https://github.com/microsoft/vscode/issues/80202
|
||||
},
|
||||
output: {
|
||||
comments: preserveComments(<FileWithCopyright>f),
|
||||
max_line_len: 1024
|
||||
|
||||
@@ -11,6 +11,9 @@ const Lint = require("tslint");
|
||||
*/
|
||||
class Rule extends Lint.Rules.AbstractRule {
|
||||
apply(sourceFile) {
|
||||
if (/\.d.ts$/.test(sourceFile.fileName)) {
|
||||
return [];
|
||||
}
|
||||
return this.applyWithWalker(new NoUnexternalizedStringsRuleWalker(sourceFile, this.getOptions()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ import * as Lint from 'tslint';
|
||||
*/
|
||||
export class Rule extends Lint.Rules.AbstractRule {
|
||||
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
|
||||
if (/\.d.ts$/.test(sourceFile.fileName)) {
|
||||
return [];
|
||||
}
|
||||
return this.applyWithWalker(new NoUnexternalizedStringsRuleWalker(sourceFile, this.getOptions()));
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
-1
@@ -8,7 +8,10 @@ declare module "gulp-tsb" {
|
||||
|
||||
export interface IncrementalCompiler {
|
||||
(token?: ICancellationToken): NodeJS.ReadWriteStream;
|
||||
src(): NodeJS.ReadStream;
|
||||
src(opts?: {
|
||||
cwd?: string;
|
||||
base?: string;
|
||||
}): NodeJS.ReadStream;
|
||||
}
|
||||
export function create(projectPath: string, existingOptions: any, verbose?: boolean, onError?: (message: any) => void): IncrementalCompiler;
|
||||
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ function loadSourcemaps() {
|
||||
return;
|
||||
}
|
||||
if (!f.contents) {
|
||||
cb(new Error('empty file'));
|
||||
cb(undefined, f);
|
||||
return;
|
||||
}
|
||||
const contents = f.contents.toString('utf8');
|
||||
|
||||
+1
-1
@@ -165,7 +165,7 @@ export function loadSourcemaps(): NodeJS.ReadWriteStream {
|
||||
}
|
||||
|
||||
if (!f.contents) {
|
||||
cb(new Error('empty file'));
|
||||
cb(undefined, f);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,17 +5,6 @@
|
||||
|
||||
const es = require('event-stream');
|
||||
|
||||
/** Ugly hack for gulp-tsb */
|
||||
function handleDeletions() {
|
||||
return es.mapSync(f => {
|
||||
if (/\.ts$/.test(f.relative) && !f.contents) {
|
||||
f.contents = Buffer.from('');
|
||||
f.stat = { mtime: new Date() };
|
||||
}
|
||||
|
||||
return f;
|
||||
});
|
||||
}
|
||||
|
||||
let watch = undefined;
|
||||
|
||||
@@ -24,6 +13,5 @@ if (!watch) {
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
return watch.apply(null, arguments)
|
||||
.pipe(handleDeletions());
|
||||
return watch.apply(null, arguments);
|
||||
};
|
||||
|
||||
+3
-2
@@ -148,8 +148,9 @@ function getMassagedTopLevelDeclarationText(sourceFile, declaration, importName,
|
||||
}
|
||||
});
|
||||
}
|
||||
result = result.replace(/export default/g, 'export');
|
||||
result = result.replace(/export declare/g, 'export');
|
||||
result = result.replace(/export default /g, 'export ');
|
||||
result = result.replace(/export declare /g, 'export ');
|
||||
result = result.replace(/declare /g, '');
|
||||
if (declaration.kind === ts.SyntaxKind.EnumDeclaration) {
|
||||
result = result.replace(/const enum/, 'enum');
|
||||
enums.push(result);
|
||||
|
||||
+3
-2
@@ -178,8 +178,9 @@ function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declarati
|
||||
}
|
||||
});
|
||||
}
|
||||
result = result.replace(/export default/g, 'export');
|
||||
result = result.replace(/export declare/g, 'export');
|
||||
result = result.replace(/export default /g, 'export ');
|
||||
result = result.replace(/export declare /g, 'export ');
|
||||
result = result.replace(/declare /g, '');
|
||||
|
||||
if (declaration.kind === ts.SyntaxKind.EnumDeclaration) {
|
||||
result = result.replace(/const enum/, 'enum');
|
||||
|
||||
@@ -62,6 +62,7 @@ export interface ICommandHandler {
|
||||
#includeAll(vs/editor/common/editorCommon;editorOptions.=>): IScrollEvent
|
||||
#includeAll(vs/editor/common/model/textModelEvents):
|
||||
#includeAll(vs/editor/common/controller/cursorEvents):
|
||||
#include(vs/platform/accessibility/common/accessibility): AccessibilitySupport
|
||||
#includeAll(vs/editor/common/config/editorOptions):
|
||||
#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>):
|
||||
#include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@
|
||||
"mime": "^1.3.4",
|
||||
"minimist": "^1.2.0",
|
||||
"request": "^2.85.0",
|
||||
"terser": "^4.2.1",
|
||||
"terser": "4.3.1",
|
||||
"tslint": "^5.9.1",
|
||||
"typescript": "3.6.2",
|
||||
"vsce": "1.48.0",
|
||||
|
||||
+13
-4
@@ -2169,7 +2169,7 @@ supports-color@^5.3.0:
|
||||
dependencies:
|
||||
has-flag "^3.0.0"
|
||||
|
||||
terser@*, terser@^4.2.1:
|
||||
terser@*:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-4.2.1.tgz#1052cfe17576c66e7bc70fcc7119f22b155bdac1"
|
||||
integrity sha512-cGbc5utAcX4a9+2GGVX4DsenG6v0x3glnDi5hx8816X1McEAwPlPgRtXPJzSBsbpILxZ8MQMT0KvArLuE0HP5A==
|
||||
@@ -2178,6 +2178,15 @@ terser@*, terser@^4.2.1:
|
||||
source-map "~0.6.1"
|
||||
source-map-support "~0.5.12"
|
||||
|
||||
terser@4.3.1:
|
||||
version "4.3.1"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.1.tgz#09820bcb3398299c4b48d9a86aefc65127d0ed65"
|
||||
integrity sha512-pnzH6dnFEsR2aa2SJaKb1uSCl3QmIsJ8dEkj0Fky+2AwMMcC9doMqLOQIH6wVTEKaVfKVvLSk5qxPBEZT9mywg==
|
||||
dependencies:
|
||||
commander "^2.20.0"
|
||||
source-map "~0.6.1"
|
||||
source-map-support "~0.5.12"
|
||||
|
||||
through2@2.X, through2@^2.0.0, through2@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be"
|
||||
@@ -2424,9 +2433,9 @@ vsce@1.48.0:
|
||||
yazl "^2.2.2"
|
||||
|
||||
vscode-ripgrep@^1.5.6:
|
||||
version "1.5.6"
|
||||
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.5.6.tgz#93bf5c99ca5f8248950a305e224f6ca153c30af4"
|
||||
integrity sha512-WRIM9XpUj6dsfdAmuI3ANbmT1ysPUVsYy/2uCLDHJa9kbiB4T7uGvFnnc0Rgx2qQnyRAwL7PeWaFgUljPPxf2g==
|
||||
version "1.5.7"
|
||||
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.5.7.tgz#acb6b548af488a4bca5d0f1bb5faf761343289ce"
|
||||
integrity sha512-/Vsz/+k8kTvui0q3O74pif9FK0nKopgFTiGNVvxicZANxtSA8J8gUE9GQ/4dpi7D/2yI/YVORszwVskFbz46hQ==
|
||||
|
||||
vscode-telemetry-extractor@^1.5.4:
|
||||
version "1.5.4"
|
||||
|
||||
@@ -71,6 +71,7 @@ class SyncStatusBar {
|
||||
|
||||
const onEnablementChange = filterEvent(workspace.onDidChangeConfiguration, e => e.affectsConfiguration('git.enableStatusBarSync'));
|
||||
onEnablementChange(this.updateEnablement, this, this.disposables);
|
||||
this.updateEnablement();
|
||||
|
||||
this._onDidChange.fire();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"main": "./out/htmlServerMain",
|
||||
"dependencies": {
|
||||
"vscode-css-languageservice": "^4.0.3-next.6",
|
||||
"vscode-html-languageservice": "^3.0.4-next.2",
|
||||
"vscode-html-languageservice": "^3.0.4-next.3",
|
||||
"vscode-languageserver": "^5.3.0-next.8",
|
||||
"vscode-languageserver-types": "3.15.0-next.2",
|
||||
"vscode-nls": "^4.1.1",
|
||||
|
||||
@@ -46,8 +46,8 @@ suite('HTML Embedded Formatting', () => {
|
||||
}
|
||||
|
||||
function assertFormatWithFixture(fixtureName: string, expectedPath: string, options?: any, formatOptions?: FormattingOptions): void {
|
||||
let input = fs.readFileSync(path.join(__dirname, 'fixtures', 'inputs', fixtureName)).toString().replace(/\r\n/mg, '\n');
|
||||
let expected = fs.readFileSync(path.join(__dirname, 'fixtures', 'expected', expectedPath)).toString().replace(/\r\n/mg, '\n');
|
||||
let input = fs.readFileSync(path.join(__dirname, '..', '..', 'src', 'test', 'fixtures', 'inputs', fixtureName)).toString().replace(/\r\n/mg, '\n');
|
||||
let expected = fs.readFileSync(path.join(__dirname, '..', '..', 'src', 'test', 'fixtures', 'expected', expectedPath)).toString().replace(/\r\n/mg, '\n');
|
||||
assertFormat(input, expected, options, formatOptions, expectedPath);
|
||||
}
|
||||
|
||||
@@ -208,4 +208,4 @@ preserve_newlines: true
|
||||
unformatted: Array(1)["wbr"]
|
||||
wrap_attributes: "auto"
|
||||
wrap_attributes_indent_size: undefined
|
||||
wrap_line_length: 120*/
|
||||
wrap_line_length: 120*/
|
||||
|
||||
@@ -238,10 +238,10 @@ vscode-css-languageservice@^4.0.3-next.6:
|
||||
vscode-nls "^4.1.1"
|
||||
vscode-uri "^2.0.3"
|
||||
|
||||
vscode-html-languageservice@^3.0.4-next.2:
|
||||
version "3.0.4-next.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-html-languageservice/-/vscode-html-languageservice-3.0.4-next.2.tgz#afdbe2781daa0a72613afac77068593925bd2e07"
|
||||
integrity sha512-tlyiflBm/k/PoTwGzg4LL0cwq6wS7mnKxDVYSlY2Iw21dONWINaS0MynYCn6Zs4PzIpgueCSMuTBQTey4d+BBQ==
|
||||
vscode-html-languageservice@^3.0.4-next.3:
|
||||
version "3.0.4-next.3"
|
||||
resolved "https://registry.yarnpkg.com/vscode-html-languageservice/-/vscode-html-languageservice-3.0.4-next.3.tgz#7a0fc33aae846165b157acbb8b133cc3fcf2ca0d"
|
||||
integrity sha512-PGIcKFxqsvVMv51QWreuQx9LhN43Vzhgl8RYI8CcWThjl+J8uUKImjwAWq9zndOiiRUPF2Zk7zME/dMIis1hOw==
|
||||
dependencies:
|
||||
vscode-languageserver-types "^3.15.0-next.2"
|
||||
vscode-nls "^4.1.1"
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,13 +1,7 @@
|
||||
{
|
||||
"extends": "../../shared.tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/",
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"jsx": "react",
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"strictBindCallApply": true,
|
||||
"noImplicitAny": true,
|
||||
"noUnusedLocals": true
|
||||
"jsx": "react"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"version": "0.0.1",
|
||||
"description": "Dependencies shared by all extensions",
|
||||
"dependencies": {
|
||||
"typescript": "3.6.2"
|
||||
"typescript": "3.6.3-insiders.20190909"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node ./postinstall"
|
||||
|
||||
+20
-20
@@ -1,7 +1,7 @@
|
||||
[
|
||||
{
|
||||
"c": "{",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments punctuation.definition.dictionary.begin.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json punctuation.definition.dictionary.begin.json",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
@@ -12,7 +12,7 @@
|
||||
},
|
||||
{
|
||||
"c": "\t",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
{
|
||||
"c": "\"",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments punctuation.support.type.property-name.begin.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json string.json support.type.property-name.json punctuation.support.type.property-name.begin.json",
|
||||
"r": {
|
||||
"dark_plus": "support.type.property-name: #9CDCFE",
|
||||
"light_plus": "support.type.property-name.json: #0451A5",
|
||||
@@ -34,7 +34,7 @@
|
||||
},
|
||||
{
|
||||
"c": "compilerOptions",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json string.json support.type.property-name.json",
|
||||
"r": {
|
||||
"dark_plus": "support.type.property-name: #9CDCFE",
|
||||
"light_plus": "support.type.property-name.json: #0451A5",
|
||||
@@ -45,7 +45,7 @@
|
||||
},
|
||||
{
|
||||
"c": "\"",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments punctuation.support.type.property-name.end.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json string.json support.type.property-name.json punctuation.support.type.property-name.end.json",
|
||||
"r": {
|
||||
"dark_plus": "support.type.property-name: #9CDCFE",
|
||||
"light_plus": "support.type.property-name.json: #0451A5",
|
||||
@@ -56,7 +56,7 @@
|
||||
},
|
||||
{
|
||||
"c": ":",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments punctuation.separator.dictionary.key-value.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json punctuation.separator.dictionary.key-value.json",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
@@ -67,7 +67,7 @@
|
||||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
@@ -78,7 +78,7 @@
|
||||
},
|
||||
{
|
||||
"c": "{",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments punctuation.definition.dictionary.begin.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json punctuation.definition.dictionary.begin.json",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
@@ -89,7 +89,7 @@
|
||||
},
|
||||
{
|
||||
"c": "\t\t",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
@@ -100,7 +100,7 @@
|
||||
},
|
||||
{
|
||||
"c": "\"",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments punctuation.support.type.property-name.begin.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json string.json support.type.property-name.json punctuation.support.type.property-name.begin.json",
|
||||
"r": {
|
||||
"dark_plus": "support.type.property-name: #9CDCFE",
|
||||
"light_plus": "support.type.property-name.json: #0451A5",
|
||||
@@ -111,7 +111,7 @@
|
||||
},
|
||||
{
|
||||
"c": "target",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json string.json support.type.property-name.json",
|
||||
"r": {
|
||||
"dark_plus": "support.type.property-name: #9CDCFE",
|
||||
"light_plus": "support.type.property-name.json: #0451A5",
|
||||
@@ -122,7 +122,7 @@
|
||||
},
|
||||
{
|
||||
"c": "\"",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments punctuation.support.type.property-name.end.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json string.json support.type.property-name.json punctuation.support.type.property-name.end.json",
|
||||
"r": {
|
||||
"dark_plus": "support.type.property-name: #9CDCFE",
|
||||
"light_plus": "support.type.property-name.json: #0451A5",
|
||||
@@ -133,7 +133,7 @@
|
||||
},
|
||||
{
|
||||
"c": ":",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments punctuation.separator.dictionary.key-value.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json punctuation.separator.dictionary.key-value.json",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
@@ -144,7 +144,7 @@
|
||||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
@@ -155,7 +155,7 @@
|
||||
},
|
||||
{
|
||||
"c": "\"",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments string.quoted.double.json.comments punctuation.definition.string.begin.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json punctuation.definition.string.begin.json",
|
||||
"r": {
|
||||
"dark_plus": "string: #CE9178",
|
||||
"light_plus": "string: #A31515",
|
||||
@@ -166,7 +166,7 @@
|
||||
},
|
||||
{
|
||||
"c": "es6",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments string.quoted.double.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json",
|
||||
"r": {
|
||||
"dark_plus": "string: #CE9178",
|
||||
"light_plus": "string: #A31515",
|
||||
@@ -177,7 +177,7 @@
|
||||
},
|
||||
{
|
||||
"c": "\"",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments string.quoted.double.json.comments punctuation.definition.string.end.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json punctuation.definition.string.end.json",
|
||||
"r": {
|
||||
"dark_plus": "string: #CE9178",
|
||||
"light_plus": "string: #A31515",
|
||||
@@ -188,7 +188,7 @@
|
||||
},
|
||||
{
|
||||
"c": "\t",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
@@ -199,7 +199,7 @@
|
||||
},
|
||||
{
|
||||
"c": "}",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments punctuation.definition.dictionary.end.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json punctuation.definition.dictionary.end.json",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
@@ -210,7 +210,7 @@
|
||||
},
|
||||
{
|
||||
"c": "}",
|
||||
"t": "source.json.comments meta.structure.dictionary.json.comments punctuation.definition.dictionary.end.json.comments",
|
||||
"t": "source.json meta.structure.dictionary.json punctuation.definition.dictionary.end.json",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
@@ -2,7 +2,7 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
typescript@3.6.2:
|
||||
version "3.6.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.2.tgz#105b0f1934119dde543ac8eb71af3a91009efe54"
|
||||
integrity sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw==
|
||||
typescript@3.6.3-insiders.20190909:
|
||||
version "3.6.3-insiders.20190909"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.3-insiders.20190909.tgz#65b6b2d809288311a970819849e1964ac73e1fda"
|
||||
integrity sha512-Lr7ONd8Y05EhrI+zKoI5tgvO5dhuRDrK5pyOLG33DeMln8zb8w7Yc8AoIEyqvxB5Btj9F7zBmXBXJdTI3SuX0Q==
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.39.0",
|
||||
"distro": "f9c6a279531bde40e55acc8a4a6d5d526f90333f",
|
||||
"distro": "11a8f56d5044ab27417b2d81f5d8f65c5d55f48c",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
@@ -49,10 +49,10 @@
|
||||
"vscode-chokidar": "2.1.7",
|
||||
"vscode-minimist": "^1.2.1",
|
||||
"vscode-proxy-agent": "0.4.0",
|
||||
"vscode-ripgrep": "^1.5.6",
|
||||
"vscode-ripgrep": "^1.5.7",
|
||||
"vscode-sqlite3": "4.0.8",
|
||||
"vscode-textmate": "^4.2.2",
|
||||
"xterm": "3.15.0-beta101",
|
||||
"xterm": "3.15.0-beta108",
|
||||
"xterm-addon-search": "0.2.0-beta5",
|
||||
"xterm-addon-web-links": "0.1.0-beta10",
|
||||
"yauzl": "^2.9.2",
|
||||
@@ -97,7 +97,7 @@
|
||||
"gulp-rename": "^1.2.0",
|
||||
"gulp-replace": "^0.5.4",
|
||||
"gulp-shell": "^0.6.5",
|
||||
"gulp-tsb": "4.0.0",
|
||||
"gulp-tsb": "4.0.2",
|
||||
"gulp-tslint": "^8.1.3",
|
||||
"gulp-untar": "^0.0.7",
|
||||
"gulp-vinyl-zip": "^2.1.2",
|
||||
|
||||
+2
-2
@@ -19,9 +19,9 @@
|
||||
"vscode-chokidar": "2.1.7",
|
||||
"vscode-minimist": "^1.2.1",
|
||||
"vscode-proxy-agent": "0.4.0",
|
||||
"vscode-ripgrep": "^1.5.6",
|
||||
"vscode-ripgrep": "^1.5.7",
|
||||
"vscode-textmate": "^4.2.2",
|
||||
"xterm": "3.15.0-beta101",
|
||||
"xterm": "3.15.0-beta108",
|
||||
"xterm-addon-search": "0.2.0-beta5",
|
||||
"xterm-addon-web-links": "0.1.0-beta10",
|
||||
"yauzl": "^2.9.2",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"onigasm-umd": "^2.2.2",
|
||||
"semver-umd": "^5.5.3",
|
||||
"vscode-textmate": "^4.2.2",
|
||||
"xterm": "3.15.0-beta101",
|
||||
"xterm": "3.15.0-beta108",
|
||||
"xterm-addon-search": "0.2.0-beta5",
|
||||
"xterm-addon-web-links": "0.1.0-beta10"
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ xterm-addon-web-links@0.1.0-beta10:
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.1.0-beta10.tgz#610fa9773a2a5ccd41c1c83ba0e2dd2c9eb66a23"
|
||||
integrity sha512-xfpjy0V6bB4BR44qIgZQPoCMVakxb65gMscPkHpO//QxvUxKzabV3dxOsIbeZRFkUGsWTFlvz2OoaBLoNtv5gg==
|
||||
|
||||
xterm@3.15.0-beta101:
|
||||
version "3.15.0-beta101"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta101.tgz#38ffa0df5a3e9bdcb1818e74fe59b2f98b0fff69"
|
||||
integrity sha512-HRa7+FDqQ8iWBTvb1Ni+uMGILnu6k9mF7JHMHRHfWxFoQlSoGYCyfdyXlJjk68YN8GsEQREmrII6cPLiQizdEQ==
|
||||
xterm@3.15.0-beta108:
|
||||
version "3.15.0-beta108"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta108.tgz#d113f6d1e4d4b7645ab3ff002c81a4dba8a78a28"
|
||||
integrity sha512-btZXgI9BeawFzitw3EZvFPsH3kfBgJS55LOdz9DjEany3y9FfvmnVhq7wn4x1PmTU/djHobGGhMNemxptk+ryg==
|
||||
|
||||
+8
-8
@@ -1139,10 +1139,10 @@ vscode-proxy-agent@0.4.0:
|
||||
https-proxy-agent "2.2.1"
|
||||
socks-proxy-agent "4.0.1"
|
||||
|
||||
vscode-ripgrep@^1.5.6:
|
||||
version "1.5.6"
|
||||
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.5.6.tgz#93bf5c99ca5f8248950a305e224f6ca153c30af4"
|
||||
integrity sha512-WRIM9XpUj6dsfdAmuI3ANbmT1ysPUVsYy/2uCLDHJa9kbiB4T7uGvFnnc0Rgx2qQnyRAwL7PeWaFgUljPPxf2g==
|
||||
vscode-ripgrep@^1.5.7:
|
||||
version "1.5.7"
|
||||
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.5.7.tgz#acb6b548af488a4bca5d0f1bb5faf761343289ce"
|
||||
integrity sha512-/Vsz/+k8kTvui0q3O74pif9FK0nKopgFTiGNVvxicZANxtSA8J8gUE9GQ/4dpi7D/2yI/YVORszwVskFbz46hQ==
|
||||
|
||||
vscode-textmate@^4.2.2:
|
||||
version "4.2.2"
|
||||
@@ -1173,10 +1173,10 @@ xterm-addon-web-links@0.1.0-beta10:
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.1.0-beta10.tgz#610fa9773a2a5ccd41c1c83ba0e2dd2c9eb66a23"
|
||||
integrity sha512-xfpjy0V6bB4BR44qIgZQPoCMVakxb65gMscPkHpO//QxvUxKzabV3dxOsIbeZRFkUGsWTFlvz2OoaBLoNtv5gg==
|
||||
|
||||
xterm@3.15.0-beta101:
|
||||
version "3.15.0-beta101"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta101.tgz#38ffa0df5a3e9bdcb1818e74fe59b2f98b0fff69"
|
||||
integrity sha512-HRa7+FDqQ8iWBTvb1Ni+uMGILnu6k9mF7JHMHRHfWxFoQlSoGYCyfdyXlJjk68YN8GsEQREmrII6cPLiQizdEQ==
|
||||
xterm@3.15.0-beta108:
|
||||
version "3.15.0-beta108"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta108.tgz#d113f6d1e4d4b7645ab3ff002c81a4dba8a78a28"
|
||||
integrity sha512-btZXgI9BeawFzitw3EZvFPsH3kfBgJS55LOdz9DjEany3y9FfvmnVhq7wn4x1PmTU/djHobGGhMNemxptk+ryg==
|
||||
|
||||
yauzl@^2.9.2:
|
||||
version "2.10.0"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
# test that VSCode wasn't installed inside WSL
|
||||
if grep -qi Microsoft /proc/version; then
|
||||
if grep -qi Microsoft /proc/version && [ -z "$DONT_PROMPT_WSL_INSTALL" ]; then
|
||||
echo "To use VS Code with the Windows Subsystem for Linux, please install VS Code in Windows and uninstall the Linux version in WSL. You can then use the '@@PRODNAME@@' command in a WSL terminal just as you would in a normal command prompt." 1>&2
|
||||
read -e -p "Do you want to continue anyways ? [y/N] " YN
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Name=@@NAME_LONG@@ - URL Handler
|
||||
Comment=Code Editing. Redefined.
|
||||
GenericName=Text Editor
|
||||
Exec=/usr/share/@@NAME@@/@@NAME@@ --open-url %U
|
||||
Exec=@@EXEC@@ --open-url %U
|
||||
Icon=@@ICON@@
|
||||
Type=Application
|
||||
NoDisplay=true
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Name=@@NAME_LONG@@
|
||||
Comment=Code Editing. Redefined.
|
||||
GenericName=Text Editor
|
||||
Exec=/usr/share/@@NAME@@/@@NAME@@ --unity-launch %F
|
||||
Exec=@@EXEC@@ --unity-launch %F
|
||||
Icon=@@ICON@@
|
||||
Type=Application
|
||||
StartupNotify=false
|
||||
@@ -14,5 +14,5 @@ Keywords=vscode;
|
||||
|
||||
[Desktop Action new-empty-window]
|
||||
Name=New Empty Window
|
||||
Exec=/usr/share/@@NAME@@/@@NAME@@ --new-window %F
|
||||
Exec=@@EXEC@@ --new-window %F
|
||||
Icon=@@ICON@@
|
||||
|
||||
@@ -49,16 +49,14 @@ parts:
|
||||
|
||||
apps:
|
||||
@@NAME@@:
|
||||
command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@
|
||||
desktop: usr/share/applications/@@NAME@@.desktop
|
||||
command: electron-launch $SNAP/usr/share/@@NAME@@/@@NAME@@
|
||||
common-id: @@NAME@@.desktop
|
||||
environment:
|
||||
DISABLE_WAYLAND: 1
|
||||
GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas
|
||||
|
||||
url-handler:
|
||||
command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@ --open-url
|
||||
desktop: usr/share/applications/@@NAME@@-url-handler.desktop
|
||||
command: electron-launch $SNAP/usr/share/@@NAME@@/@@NAME@@ --open-url
|
||||
environment:
|
||||
DISABLE_WAYLAND: 1
|
||||
GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas
|
||||
GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas
|
||||
|
||||
@@ -47,6 +47,7 @@ function code() {
|
||||
export VSCODE_CLI=1
|
||||
export ELECTRON_ENABLE_STACK_DUMPING=1
|
||||
export ELECTRON_ENABLE_LOGGING=1
|
||||
export VSCODE_LOGS=
|
||||
|
||||
# Launch Code
|
||||
exec "$CODE" . "$@"
|
||||
|
||||
Vendored
-36
@@ -1043,39 +1043,3 @@ declare module 'xterm' {
|
||||
addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Modifications to official .d.ts below
|
||||
declare module 'xterm' {
|
||||
interface TerminalCore {
|
||||
_onScroll: IEventEmitter<number>;
|
||||
_onKey: IEventEmitter<{ key: string }>;
|
||||
|
||||
_charSizeService: {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
|
||||
_coreService: {
|
||||
triggerDataEvent(data: string, wasUserInput?: boolean): void;
|
||||
}
|
||||
|
||||
_renderService: {
|
||||
_renderer: {
|
||||
_renderLayers: any[];
|
||||
};
|
||||
_onIntersectionChange: any;
|
||||
};
|
||||
}
|
||||
|
||||
interface IEventEmitter<T> {
|
||||
fire(e: T): void;
|
||||
}
|
||||
|
||||
interface Terminal {
|
||||
_core: TerminalCore;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import { parse } from 'vs/base/common/marshalling';
|
||||
import { cloneAndChange } from 'vs/base/common/objects';
|
||||
import { escape } from 'vs/base/common/strings';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
|
||||
export interface MarkdownRenderOptions extends FormattedTextRenderOptions {
|
||||
codeBlockRenderer?: (modeId: string, value: string) => Promise<string>;
|
||||
@@ -172,9 +173,9 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende
|
||||
renderer
|
||||
};
|
||||
|
||||
const allowedSchemes = ['http', 'https', 'mailto', 'data'];
|
||||
const allowedSchemes = [Schemas.http, Schemas.https, Schemas.mailto, Schemas.data, Schemas.file, Schemas.vscodeRemote];
|
||||
if (markdown.isTrusted) {
|
||||
allowedSchemes.push('command');
|
||||
allowedSchemes.push(Schemas.command);
|
||||
}
|
||||
|
||||
const renderedMarkdown = marked.parse(markdown.value, markedOptions);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { getOrDefault } from 'vs/base/common/objects';
|
||||
import { IDisposable, dispose, Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose, Disposable, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { Gesture, EventType as TouchEventType, GestureEvent } from 'vs/base/browser/touch';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
@@ -188,7 +188,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
||||
private currentDragFeedbackDisposable: IDisposable = Disposable.None;
|
||||
private onDragLeaveTimeout: IDisposable = Disposable.None;
|
||||
|
||||
private disposables: IDisposable[];
|
||||
private readonly disposables: DisposableStore = new DisposableStore();
|
||||
|
||||
private _onDidChangeContentHeight = new Emitter<number>();
|
||||
readonly onDidChangeContentHeight: Event<number> = Event.latch(this._onDidChangeContentHeight.event);
|
||||
@@ -214,7 +214,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
||||
this.renderers.set(renderer.templateId, renderer);
|
||||
}
|
||||
|
||||
this.cache = new RowCache(this.renderers);
|
||||
this.cache = this.disposables.add(new RowCache(this.renderers));
|
||||
|
||||
this.lastRenderTop = 0;
|
||||
this.lastRenderHeight = 0;
|
||||
@@ -238,18 +238,16 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
||||
this.rowsContainer.className = 'monaco-list-rows';
|
||||
Gesture.addTarget(this.rowsContainer);
|
||||
|
||||
this.scrollableElement = new ScrollableElement(this.rowsContainer, {
|
||||
this.scrollableElement = this.disposables.add(new ScrollableElement(this.rowsContainer, {
|
||||
alwaysConsumeMouseWheel: true,
|
||||
horizontal: this.horizontalScrolling ? ScrollbarVisibility.Auto : ScrollbarVisibility.Hidden,
|
||||
vertical: getOrDefault(options, o => o.verticalScrollMode, DefaultOptions.verticalScrollMode),
|
||||
useShadows: getOrDefault(options, o => o.useShadows, DefaultOptions.useShadows)
|
||||
});
|
||||
}));
|
||||
|
||||
this.domNode.appendChild(this.scrollableElement.getDomNode());
|
||||
container.appendChild(this.domNode);
|
||||
|
||||
this.disposables = [this.scrollableElement, this.cache];
|
||||
|
||||
this.scrollableElement.onScroll(this.onScroll, this, this.disposables);
|
||||
domEvent(this.rowsContainer, TouchEventType.Change)(this.onTouchChange, this, this.disposables);
|
||||
|
||||
@@ -1178,6 +1176,6 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
||||
this.domNode.parentNode.removeChild(this.domNode);
|
||||
}
|
||||
|
||||
this.disposables = dispose(this.disposables);
|
||||
dispose(this.disposables);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@font-face {
|
||||
font-family: "octicons2";
|
||||
src: url("./octicons2.ttf?d8711b2fb33d14ed72f2a5859ed5f80a") format("truetype"),
|
||||
url("./octicons2.svg?d8711b2fb33d14ed72f2a5859ed5f80a#octicons2") format("svg");
|
||||
src: url("./octicons2.ttf?04609cb7b40cfe676d00e166656be7e8") format("truetype"),
|
||||
url("./octicons2.svg?04609cb7b40cfe676d00e166656be7e8#octicons2") format("svg");
|
||||
}
|
||||
|
||||
.octicon, .mega-octicon {
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 234 KiB After Width: | Height: | Size: 226 KiB |
Binary file not shown.
@@ -911,7 +911,7 @@ export class SplitView extends Disposable {
|
||||
position += this.viewItems[i].size;
|
||||
|
||||
if (this.sashItems[i].sash === sash) {
|
||||
return position;
|
||||
return Math.min(position, this.contentSize - 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1053,13 +1053,15 @@ class TreeNodeListMouseController<T, TFilterData, TRef> extends MouseController<
|
||||
return super.onPointer(e);
|
||||
}
|
||||
|
||||
const model = ((this.tree as any).model as ITreeModel<T, TFilterData, TRef>); // internal
|
||||
const location = model.getNodeLocation(node);
|
||||
const recursive = e.browserEvent.altKey;
|
||||
model.setCollapsed(location, undefined, recursive);
|
||||
if (node.collapsible) {
|
||||
const model = ((this.tree as any).model as ITreeModel<T, TFilterData, TRef>); // internal
|
||||
const location = model.getNodeLocation(node);
|
||||
const recursive = e.browserEvent.altKey;
|
||||
model.setCollapsed(location, undefined, recursive);
|
||||
|
||||
if (expandOnlyOnTwistieClick && onTwistie) {
|
||||
return;
|
||||
if (expandOnlyOnTwistieClick && onTwistie) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
super.onPointer(e);
|
||||
@@ -1418,6 +1420,10 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
|
||||
return this.model.isCollapsible(location);
|
||||
}
|
||||
|
||||
setCollapsible(location: TRef, collapsible?: boolean): boolean {
|
||||
return this.model.setCollapsible(location, collapsible);
|
||||
}
|
||||
|
||||
isCollapsed(location: TRef): boolean {
|
||||
return this.model.isCollapsed(location);
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
|
||||
|
||||
const viewStateContext = viewState && { viewState, focus: [], selection: [] } as IAsyncDataTreeViewStateContext<TInput, T>;
|
||||
|
||||
await this.updateChildren(input, true, viewStateContext);
|
||||
await this._updateChildren(input, true, viewStateContext);
|
||||
|
||||
if (viewStateContext) {
|
||||
this.tree.setFocus(viewStateContext.focus);
|
||||
@@ -463,7 +463,11 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
async updateChildren(element: TInput | T = this.root.element, recursive = true, viewStateContext?: IAsyncDataTreeViewStateContext<TInput, T>): Promise<void> {
|
||||
async updateChildren(element: TInput | T = this.root.element, recursive = true): Promise<void> {
|
||||
await this._updateChildren(element, recursive);
|
||||
}
|
||||
|
||||
private async _updateChildren(element: TInput | T = this.root.element, recursive = true, viewStateContext?: IAsyncDataTreeViewStateContext<TInput, T>): Promise<void> {
|
||||
if (typeof this.root.element === 'undefined') {
|
||||
throw new TreeError(this.user, 'Tree input not set');
|
||||
}
|
||||
@@ -874,6 +878,11 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
|
||||
private render(node: IAsyncDataTreeNode<TInput, T>, viewStateContext?: IAsyncDataTreeViewStateContext<TInput, T>): void {
|
||||
const children = node.children.map(c => asTreeElement(c, viewStateContext));
|
||||
this.tree.setChildren(node === this.root ? null : node, children);
|
||||
|
||||
if (node !== this.root) {
|
||||
this.tree.setCollapsible(node, node.hasChildren);
|
||||
}
|
||||
|
||||
this._onDidRender.fire();
|
||||
}
|
||||
|
||||
|
||||
@@ -231,6 +231,11 @@ export class CompressedTreeModel<T extends NonNullable<any>, TFilterData extends
|
||||
return this.model.isCollapsible(compressedNode);
|
||||
}
|
||||
|
||||
setCollapsible(location: T | null, collapsible?: boolean): boolean {
|
||||
const compressedNode = this.getCompressedNode(location);
|
||||
return this.model.setCollapsible(compressedNode, collapsible);
|
||||
}
|
||||
|
||||
isCollapsed(location: T | null): boolean {
|
||||
const compressedNode = this.getCompressedNode(location);
|
||||
return this.model.isCollapsed(compressedNode);
|
||||
@@ -397,6 +402,10 @@ export class CompressedObjectTreeModel<T extends NonNullable<any>, TFilterData e
|
||||
return this.model.isCollapsible(location);
|
||||
}
|
||||
|
||||
setCollapsible(location: T | null, collapsed?: boolean): boolean {
|
||||
return this.model.setCollapsible(location, collapsed);
|
||||
}
|
||||
|
||||
isCollapsed(location: T | null): boolean {
|
||||
return this.model.isCollapsed(location);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,21 @@ export interface IIndexTreeModelOptions<T, TFilterData> {
|
||||
readonly autoExpandSingleChildren?: boolean;
|
||||
}
|
||||
|
||||
interface CollapsibleStateUpdate {
|
||||
readonly collapsible: boolean;
|
||||
}
|
||||
|
||||
interface CollapsedStateUpdate {
|
||||
readonly collapsed: boolean;
|
||||
readonly recursive: boolean;
|
||||
}
|
||||
|
||||
type CollapseStateUpdate = CollapsibleStateUpdate | CollapsedStateUpdate;
|
||||
|
||||
function isCollapsibleStateUpdate(update: CollapseStateUpdate): update is CollapsibleStateUpdate {
|
||||
return typeof (update as any).collapsible === 'boolean';
|
||||
}
|
||||
|
||||
export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = void> implements ITreeModel<T, TFilterData, number[]> {
|
||||
|
||||
readonly rootRef = [];
|
||||
@@ -205,6 +220,17 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
|
||||
return this.getTreeNode(location).collapsible;
|
||||
}
|
||||
|
||||
setCollapsible(location: number[], collapsible?: boolean): boolean {
|
||||
const node = this.getTreeNode(location);
|
||||
|
||||
if (typeof collapsible === 'undefined') {
|
||||
collapsible = !node.collapsible;
|
||||
}
|
||||
|
||||
const update: CollapsibleStateUpdate = { collapsible };
|
||||
return this.eventBufferer.bufferEvents(() => this._setCollapseState(location, update));
|
||||
}
|
||||
|
||||
isCollapsed(location: number[]): boolean {
|
||||
return this.getTreeNode(location).collapsed;
|
||||
}
|
||||
@@ -216,15 +242,16 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
|
||||
collapsed = !node.collapsed;
|
||||
}
|
||||
|
||||
return this.eventBufferer.bufferEvents(() => this._setCollapsed(location, collapsed!, recursive));
|
||||
const update: CollapsedStateUpdate = { collapsed, recursive: recursive || false };
|
||||
return this.eventBufferer.bufferEvents(() => this._setCollapseState(location, update));
|
||||
}
|
||||
|
||||
private _setCollapsed(location: number[], collapsed: boolean, recursive?: boolean): boolean {
|
||||
private _setCollapseState(location: number[], update: CollapseStateUpdate): boolean {
|
||||
const { node, listIndex, revealed } = this.getTreeNodeWithListIndex(location);
|
||||
|
||||
const result = this._setListNodeCollapsed(node, listIndex, revealed, collapsed!, recursive || false);
|
||||
const result = this._setListNodeCollapseState(node, listIndex, revealed, update);
|
||||
|
||||
if (node !== this.root && this.autoExpandSingleChildren && !collapsed! && !recursive) {
|
||||
if (node !== this.root && this.autoExpandSingleChildren && result && !isCollapsibleStateUpdate(update) && node.collapsible && !node.collapsed && !update.recursive) {
|
||||
let onlyVisibleChildIndex = -1;
|
||||
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
@@ -241,17 +268,17 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
|
||||
}
|
||||
|
||||
if (onlyVisibleChildIndex > -1) {
|
||||
this._setCollapsed([...location, onlyVisibleChildIndex], false, false);
|
||||
this._setCollapseState([...location, onlyVisibleChildIndex], update);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private _setListNodeCollapsed(node: IMutableTreeNode<T, TFilterData>, listIndex: number, revealed: boolean, collapsed: boolean, recursive: boolean): boolean {
|
||||
const result = this._setNodeCollapsed(node, collapsed, recursive, false);
|
||||
private _setListNodeCollapseState(node: IMutableTreeNode<T, TFilterData>, listIndex: number, revealed: boolean, update: CollapseStateUpdate): boolean {
|
||||
const result = this._setNodeCollapseState(node, update, false);
|
||||
|
||||
if (!revealed || !node.visible) {
|
||||
if (!revealed || !node.visible || !result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -263,20 +290,28 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
|
||||
return result;
|
||||
}
|
||||
|
||||
private _setNodeCollapsed(node: IMutableTreeNode<T, TFilterData>, collapsed: boolean, recursive: boolean, deep: boolean): boolean {
|
||||
let result = node.collapsible && node.collapsed !== collapsed;
|
||||
private _setNodeCollapseState(node: IMutableTreeNode<T, TFilterData>, update: CollapseStateUpdate, deep: boolean): boolean {
|
||||
let result: boolean;
|
||||
|
||||
if (node.collapsible) {
|
||||
node.collapsed = collapsed;
|
||||
if (node === this.root) {
|
||||
result = false;
|
||||
} else {
|
||||
if (isCollapsibleStateUpdate(update)) {
|
||||
result = node.collapsible !== update.collapsible;
|
||||
node.collapsible = update.collapsible;
|
||||
} else {
|
||||
result = node.collapsed !== update.collapsed;
|
||||
node.collapsed = update.collapsed;
|
||||
}
|
||||
|
||||
if (result) {
|
||||
this._onDidChangeCollapseState.fire({ node, deep });
|
||||
}
|
||||
}
|
||||
|
||||
if (recursive) {
|
||||
if (!isCollapsibleStateUpdate(update) && update.recursive) {
|
||||
for (const child of node.children) {
|
||||
result = this._setNodeCollapsed(child, collapsed, true, true) || result;
|
||||
result = this._setNodeCollapseState(child, update, true) || result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +327,7 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
|
||||
location = location.slice(0, location.length - 1);
|
||||
|
||||
if (node.collapsed) {
|
||||
this._setCollapsed(location, false);
|
||||
this._setCollapseState(location, { collapsed: false, recursive: false });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -216,6 +216,11 @@ export class ObjectTreeModel<T extends NonNullable<any>, TFilterData extends Non
|
||||
return this.model.isCollapsible(location);
|
||||
}
|
||||
|
||||
setCollapsible(element: T | null, collapsible?: boolean): boolean {
|
||||
const location = this.getElementLocation(element);
|
||||
return this.model.setCollapsible(location, collapsible);
|
||||
}
|
||||
|
||||
isCollapsed(element: T | null): boolean {
|
||||
const location = this.getElementLocation(element);
|
||||
return this.model.isCollapsed(location);
|
||||
|
||||
@@ -120,6 +120,7 @@ export interface ITreeModel<T, TFilterData, TRef> {
|
||||
getLastElementAncestor(location?: TRef): T | undefined;
|
||||
|
||||
isCollapsible(location: TRef): boolean;
|
||||
setCollapsible(location: TRef, collapsible?: boolean): boolean;
|
||||
isCollapsed(location: TRef): boolean;
|
||||
setCollapsed(location: TRef, collapsed?: boolean, recursive?: boolean): boolean;
|
||||
expandTo(location: TRef): void;
|
||||
|
||||
@@ -8,3 +8,11 @@ import { URI } from 'vs/base/common/uri';
|
||||
export function getPathFromAmdModule(requirefn: typeof require, relativePath: string): string {
|
||||
return URI.parse(requirefn.toUrl(relativePath)).fsPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference a resource that might be inlined.
|
||||
* Do not rename this method unless you adopt the build scripts.
|
||||
*/
|
||||
export function registerAndGetAmdImageURL(absolutePath: string): string {
|
||||
return require.toUrl(absolutePath);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,6 @@
|
||||
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
|
||||
/**
|
||||
* The empty string.
|
||||
*/
|
||||
export const empty = '';
|
||||
|
||||
export function isFalsyOrWhitespace(str: string | undefined): boolean {
|
||||
if (!str || typeof str !== 'string') {
|
||||
return true;
|
||||
@@ -70,7 +65,7 @@ export function escape(html: string): string {
|
||||
* Escapes regular expression characters in a given string
|
||||
*/
|
||||
export function escapeRegExpCharacters(value: string): string {
|
||||
return value.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)\#]/g, '\\$&');
|
||||
return value.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g, '\\$&');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -608,7 +603,7 @@ export function lcut(text: string, n: number) {
|
||||
re.lastIndex += 1;
|
||||
}
|
||||
|
||||
return text.substring(i).replace(/^\s/, empty);
|
||||
return text.substring(i).replace(/^\s/, '');
|
||||
}
|
||||
|
||||
// Escape codes
|
||||
@@ -636,7 +631,7 @@ export const removeAccents: (str: string) => string = (function () {
|
||||
// see: https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript/37511463#37511463
|
||||
const regex = /[\u0300-\u036f]/g;
|
||||
return function (str: string) {
|
||||
return (str as any).normalize('NFD').replace(regex, empty);
|
||||
return (str as any).normalize('NFD').replace(regex, '');
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -355,4 +355,38 @@ suite('AsyncDataTree', function () {
|
||||
race = await Promise.race([pExpandA.then(() => 'expand'), timeout(1).then(() => 'timeout')]);
|
||||
assert.equal(race, 'expand', 'expand(a) should now be done');
|
||||
});
|
||||
|
||||
test('issue #78388 - tree should react to hasChildren toggles', async () => {
|
||||
const container = document.createElement('div');
|
||||
const model = new Model({
|
||||
id: 'root',
|
||||
children: [{
|
||||
id: 'a'
|
||||
}]
|
||||
});
|
||||
|
||||
const tree = new AsyncDataTree<Element, Element>('test', container, new VirtualDelegate(), [new Renderer()], new DataSource(), { identityProvider: new IdentityProvider() });
|
||||
tree.layout(200);
|
||||
|
||||
await tree.setInput(model.root);
|
||||
assert.equal(container.querySelectorAll('.monaco-list-row').length, 1);
|
||||
|
||||
let twistie = container.querySelector('.monaco-list-row:first-child .monaco-tl-twistie') as HTMLElement;
|
||||
assert(!hasClass(twistie, 'collapsible'));
|
||||
assert(!hasClass(twistie, 'collapsed'));
|
||||
|
||||
model.get('a').children = [{ id: 'aa' }];
|
||||
await tree.updateChildren(model.get('a'), false);
|
||||
assert.equal(container.querySelectorAll('.monaco-list-row').length, 1);
|
||||
twistie = container.querySelector('.monaco-list-row:first-child .monaco-tl-twistie') as HTMLElement;
|
||||
assert(hasClass(twistie, 'collapsible'));
|
||||
assert(hasClass(twistie, 'collapsed'));
|
||||
|
||||
model.get('a').children = [];
|
||||
await tree.updateChildren(model.get('a'), false);
|
||||
assert.equal(container.querySelectorAll('.monaco-list-row').length, 1);
|
||||
twistie = container.querySelector('.monaco-list-row:first-child .monaco-tl-twistie') as HTMLElement;
|
||||
assert(!hasClass(twistie, 'collapsible'));
|
||||
assert(!hasClass(twistie, 'collapsed'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -333,6 +333,67 @@ suite('IndexTreeModel', function () {
|
||||
assert.deepEqual(toArray(list), [1, 11, 2]);
|
||||
});
|
||||
|
||||
test('setCollapsible', () => {
|
||||
const list: ITreeNode<number>[] = [];
|
||||
const model = new IndexTreeModel<number>('test', toSpliceable(list), -1);
|
||||
|
||||
model.splice([0], 0, Iterator.fromArray([
|
||||
{
|
||||
element: 0, children: Iterator.fromArray([
|
||||
{ element: 10 }
|
||||
])
|
||||
}
|
||||
]));
|
||||
|
||||
assert.deepEqual(list.length, 2);
|
||||
|
||||
model.setCollapsible([0], false);
|
||||
assert.deepEqual(list.length, 2);
|
||||
assert.deepEqual(list[0].element, 0);
|
||||
assert.deepEqual(list[0].collapsible, false);
|
||||
assert.deepEqual(list[0].collapsed, false);
|
||||
assert.deepEqual(list[1].element, 10);
|
||||
assert.deepEqual(list[1].collapsible, false);
|
||||
assert.deepEqual(list[1].collapsed, false);
|
||||
|
||||
model.setCollapsed([0], true);
|
||||
assert.deepEqual(list.length, 1);
|
||||
assert.deepEqual(list[0].element, 0);
|
||||
assert.deepEqual(list[0].collapsible, false);
|
||||
assert.deepEqual(list[0].collapsed, true);
|
||||
|
||||
model.setCollapsed([0], false);
|
||||
assert.deepEqual(list[0].element, 0);
|
||||
assert.deepEqual(list[0].collapsible, false);
|
||||
assert.deepEqual(list[0].collapsed, false);
|
||||
assert.deepEqual(list[1].element, 10);
|
||||
assert.deepEqual(list[1].collapsible, false);
|
||||
assert.deepEqual(list[1].collapsed, false);
|
||||
|
||||
model.setCollapsible([0], true);
|
||||
assert.deepEqual(list.length, 2);
|
||||
assert.deepEqual(list[0].element, 0);
|
||||
assert.deepEqual(list[0].collapsible, true);
|
||||
assert.deepEqual(list[0].collapsed, false);
|
||||
assert.deepEqual(list[1].element, 10);
|
||||
assert.deepEqual(list[1].collapsible, false);
|
||||
assert.deepEqual(list[1].collapsed, false);
|
||||
|
||||
model.setCollapsed([0], true);
|
||||
assert.deepEqual(list.length, 1);
|
||||
assert.deepEqual(list[0].element, 0);
|
||||
assert.deepEqual(list[0].collapsible, true);
|
||||
assert.deepEqual(list[0].collapsed, true);
|
||||
|
||||
model.setCollapsed([0], false);
|
||||
assert.deepEqual(list[0].element, 0);
|
||||
assert.deepEqual(list[0].collapsible, true);
|
||||
assert.deepEqual(list[0].collapsed, false);
|
||||
assert.deepEqual(list[1].element, 10);
|
||||
assert.deepEqual(list[1].collapsible, false);
|
||||
assert.deepEqual(list[1].collapsed, false);
|
||||
});
|
||||
|
||||
test('simple filter', function () {
|
||||
const list: ITreeNode<number>[] = [];
|
||||
const filter = new class implements ITreeFilter<number> {
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<!-- 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, minimum-scale=1.0, user-scalable=no">
|
||||
|
||||
<!-- Content Security Policy -->
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="
|
||||
default-src 'self';
|
||||
img-src 'self' https: data: blob:;
|
||||
media-src 'none';
|
||||
script-src 'self';
|
||||
style-src 'self' 'unsafe-inline';
|
||||
font-src 'self' blob:;
|
||||
">
|
||||
|
||||
<title>Visual Studio Code</title>
|
||||
|
||||
<!-- Styling -->
|
||||
<style type="text/css">
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
box-sizing: border-box;
|
||||
min-height: 100%;
|
||||
margin: 0;
|
||||
padding: 15px 30px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
color: white;
|
||||
font-family: "Segoe UI", "Helvetica Neue", "Helvetica", Arial, sans-serif;
|
||||
background-color: #373277;
|
||||
}
|
||||
|
||||
.branding {
|
||||
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGRlZnM+PHN0eWxlPi5pY29uLWNhbnZhcy10cmFuc3BhcmVudHtmaWxsOiNmNmY2ZjY7b3BhY2l0eTowO30uaWNvbi13aGl0ZXtmaWxsOiNmZmY7fTwvc3R5bGU+PC9kZWZzPjx0aXRsZT5CcmFuZFZpc3VhbFN0dWRpb0NvZGUyMDE3UlRXXzI0eF93aGl0ZV8yNHg8L3RpdGxlPjxwYXRoIGNsYXNzPSJpY29uLWNhbnZhcy10cmFuc3BhcmVudCIgZD0iTTI0LDBWMjRIMFYwWiIvPjxwYXRoIGNsYXNzPSJpY29uLXdoaXRlIiBkPSJNMjQsMi41VjIxLjVMMTgsMjQsMCwxOC41di0uNTYxbDE4LDEuNTQ1VjBaTTEsMTMuMTExLDQuMzg1LDEwLDEsNi44ODlsMS40MTgtLjgyN0w1Ljg1Myw4LjY1LDEyLDNsMywxLjQ1NlYxNS41NDRMMTIsMTcsNS44NTMsMTEuMzUsMi40MTksMTMuOTM5Wk03LjY0NCwxMCwxMiwxMy4yODNWNi43MTdaIi8+PC9zdmc+");
|
||||
background-size: 24px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: left 50%;
|
||||
padding-left: 36px;
|
||||
font-size: 20px;
|
||||
letter-spacing: -0.04rem;
|
||||
font-weight: 400;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.message-container {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 30px;
|
||||
}
|
||||
|
||||
.message {
|
||||
font-weight: 300;
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<span class="branding">
|
||||
Visual Studio Code
|
||||
</span>
|
||||
<div class="message-container">
|
||||
<div class="message">
|
||||
You can close this page now.
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,210 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IWorkbenchConstructionOptions, create } from 'vs/workbench/workbench.web.api';
|
||||
import { IURLCallbackProvider } from 'vs/workbench/services/url/browser/urlService';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { streamToBuffer } from 'vs/base/common/buffer';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { request } from 'vs/base/parts/request/browser/request';
|
||||
import { ICredentialsProvider } from 'vs/workbench/services/credentials/browser/credentialsService';
|
||||
|
||||
export function main(): void {
|
||||
const options: IWorkbenchConstructionOptions = JSON.parse(document.getElementById('vscode-workbench-web-configuration')!.getAttribute('data-settings')!);
|
||||
options.urlCallbackProvider = new PollingURLCallbackProvider();
|
||||
options.credentialsProvider = new LocalStorageCredentialsProvider();
|
||||
|
||||
create(document.body, options);
|
||||
}
|
||||
|
||||
interface ICredential {
|
||||
service: string;
|
||||
account: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
class LocalStorageCredentialsProvider implements ICredentialsProvider {
|
||||
|
||||
static readonly CREDENTIALS_OPENED_KEY = 'credentials.provider';
|
||||
|
||||
private _credentials: ICredential[];
|
||||
private get credentials(): ICredential[] {
|
||||
if (!this._credentials) {
|
||||
try {
|
||||
const serializedCredentials = window.localStorage.getItem(LocalStorageCredentialsProvider.CREDENTIALS_OPENED_KEY);
|
||||
if (serializedCredentials) {
|
||||
this._credentials = JSON.parse(serializedCredentials);
|
||||
}
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
if (!Array.isArray(this._credentials)) {
|
||||
this._credentials = [];
|
||||
}
|
||||
}
|
||||
|
||||
return this._credentials;
|
||||
}
|
||||
|
||||
private save(): void {
|
||||
window.localStorage.setItem(LocalStorageCredentialsProvider.CREDENTIALS_OPENED_KEY, JSON.stringify(this.credentials));
|
||||
}
|
||||
|
||||
async getPassword(service: string, account: string): Promise<string | null> {
|
||||
return this.doGetPassword(service, account);
|
||||
}
|
||||
|
||||
private async doGetPassword(service: string, account?: string): Promise<string | null> {
|
||||
for (const credential of this.credentials) {
|
||||
if (credential.service === service) {
|
||||
if (typeof account !== 'string' || account === credential.account) {
|
||||
return credential.password;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async setPassword(service: string, account: string, password: string): Promise<void> {
|
||||
this.deletePassword(service, account);
|
||||
|
||||
this.credentials.push({ service, account, password });
|
||||
|
||||
this.save();
|
||||
}
|
||||
|
||||
async deletePassword(service: string, account: string): Promise<boolean> {
|
||||
let found = false;
|
||||
|
||||
this._credentials = this.credentials.filter(credential => {
|
||||
if (credential.service === service && credential.account === account) {
|
||||
found = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if (found) {
|
||||
this.save();
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
async findPassword(service: string): Promise<string | null> {
|
||||
return this.doGetPassword(service);
|
||||
}
|
||||
|
||||
async findCredentials(service: string): Promise<Array<{ account: string, password: string }>> {
|
||||
return this.credentials
|
||||
.filter(credential => credential.service === service)
|
||||
.map(({ account, password }) => ({ account, password }));
|
||||
}
|
||||
}
|
||||
|
||||
class PollingURLCallbackProvider extends Disposable implements IURLCallbackProvider {
|
||||
|
||||
static FETCH_INTERVAL = 500; // fetch every 500ms
|
||||
static FETCH_TIMEOUT = 5 * 60 * 1000; // ...but stop after 5min
|
||||
|
||||
static QUERY_KEYS = {
|
||||
REQUEST_ID: 'vscode-requestId',
|
||||
SCHEME: 'vscode-scheme',
|
||||
AUTHORITY: 'vscode-authority',
|
||||
PATH: 'vscode-path',
|
||||
QUERY: 'vscode-query',
|
||||
FRAGMENT: 'vscode-fragment'
|
||||
};
|
||||
|
||||
private readonly _onCallback: Emitter<URI> = this._register(new Emitter<URI>());
|
||||
readonly onCallback: Event<URI> = this._onCallback.event;
|
||||
|
||||
create(options?: Partial<UriComponents>): URI {
|
||||
const queryValues: Map<string, string> = new Map();
|
||||
|
||||
const requestId = generateUuid();
|
||||
queryValues.set(PollingURLCallbackProvider.QUERY_KEYS.REQUEST_ID, requestId);
|
||||
|
||||
const { scheme, authority, path, query, fragment } = options ? options : { scheme: undefined, authority: undefined, path: undefined, query: undefined, fragment: undefined };
|
||||
|
||||
if (scheme) {
|
||||
queryValues.set(PollingURLCallbackProvider.QUERY_KEYS.SCHEME, scheme);
|
||||
}
|
||||
|
||||
if (authority) {
|
||||
queryValues.set(PollingURLCallbackProvider.QUERY_KEYS.AUTHORITY, authority);
|
||||
}
|
||||
|
||||
if (path) {
|
||||
queryValues.set(PollingURLCallbackProvider.QUERY_KEYS.PATH, path);
|
||||
}
|
||||
|
||||
if (query) {
|
||||
queryValues.set(PollingURLCallbackProvider.QUERY_KEYS.QUERY, query);
|
||||
}
|
||||
|
||||
if (fragment) {
|
||||
queryValues.set(PollingURLCallbackProvider.QUERY_KEYS.FRAGMENT, fragment);
|
||||
}
|
||||
|
||||
// Start to poll on the callback being fired
|
||||
this.periodicFetchCallback(requestId, Date.now());
|
||||
|
||||
return this.doCreateUri('/callback', queryValues);
|
||||
}
|
||||
|
||||
private async periodicFetchCallback(requestId: string, startTime: number): Promise<void> {
|
||||
|
||||
// Ask server for callback results
|
||||
const queryValues: Map<string, string> = new Map();
|
||||
queryValues.set(PollingURLCallbackProvider.QUERY_KEYS.REQUEST_ID, requestId);
|
||||
|
||||
const result = await request({
|
||||
url: this.doCreateUri('/fetch-callback', queryValues).toString(true)
|
||||
}, CancellationToken.None);
|
||||
|
||||
// Check for callback results
|
||||
const content = await streamToBuffer(result.stream);
|
||||
if (content.byteLength > 0) {
|
||||
try {
|
||||
this._onCallback.fire(URI.revive(JSON.parse(content.toString())));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
return; // done
|
||||
}
|
||||
|
||||
// Continue fetching unless we hit the timeout
|
||||
if (Date.now() - startTime < PollingURLCallbackProvider.FETCH_TIMEOUT) {
|
||||
setTimeout(() => this.periodicFetchCallback(requestId, startTime), PollingURLCallbackProvider.FETCH_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
private doCreateUri(path: string, queryValues: Map<string, string>): URI {
|
||||
let query: string | undefined = undefined;
|
||||
|
||||
if (queryValues) {
|
||||
let index = 0;
|
||||
queryValues.forEach((value, key) => {
|
||||
if (!query) {
|
||||
query = '';
|
||||
}
|
||||
|
||||
const prefix = (index++ === 0) ? '' : '&';
|
||||
query += `${prefix}${key}=${encodeURIComponent(value)}`;
|
||||
});
|
||||
}
|
||||
|
||||
return URI.parse(window.location.href).with({ path, query });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<!-- 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, minimum-scale=1.0, user-scalable=no">
|
||||
|
||||
<!-- Content Security Policy -->
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="
|
||||
default-src 'self';
|
||||
img-src 'self' https: data: blob:;
|
||||
media-src 'none';
|
||||
script-src 'self' https://az416426.vo.msecnd.net 'unsafe-eval' https: 'sha256-4DqvCTjCHj2KW4QxC/Yt6uBwMRyYiEg7kOoykSEkonQ=' 'sha256-g94DXzh59qc37AZjL7sV1lYN7OX4K1fgKl4ts5tAQDw=';
|
||||
child-src 'self';
|
||||
frame-src 'self' {{WEBVIEW_ENDPOINT}} https://*.vscode-webview-test.com;
|
||||
worker-src 'self';
|
||||
style-src 'self' 'unsafe-inline';
|
||||
connect-src 'self' ws: wss: https:;
|
||||
font-src 'self' blob:;
|
||||
manifest-src 'self';
|
||||
">
|
||||
|
||||
<!-- Workbench Configuration -->
|
||||
<meta id="vscode-workbench-web-configuration" data-settings="{{WORKBENCH_WEB_CONGIGURATION}}">
|
||||
|
||||
<!-- Workarounds/Hacks (remote user data uri) -->
|
||||
<meta id="vscode-remote-user-data-uri" data-settings="{{REMOTE_USER_DATA_URI}}">
|
||||
|
||||
<!-- Workbench Icon/Manifest/CSS -->
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="./static/out/vs/workbench/workbench.web.api.css">
|
||||
</head>
|
||||
|
||||
<body aria-label="">
|
||||
</body>
|
||||
|
||||
<!-- Startup (do not modify order of script tags!) -->
|
||||
<script>
|
||||
// NOTE: Changes to inline scripts require update of content security policy
|
||||
self.require = {
|
||||
baseUrl: `${window.location.origin}/static/out`,
|
||||
paths: {
|
||||
'vscode-textmate': `${window.location.origin}/static/node_modules/vscode-textmate/release/main`,
|
||||
'onigasm-umd': `${window.location.origin}/static/node_modules/onigasm-umd/release/main`,
|
||||
'xterm': `${window.location.origin}/static/node_modules/xterm/lib/xterm.js`,
|
||||
'xterm-addon-search': `${window.location.origin}/static/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
|
||||
'xterm-addon-web-links': `${window.location.origin}/static/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
|
||||
'semver-umd': `${window.location.origin}/static/node_modules/semver-umd/lib/semver-umd.js`,
|
||||
'@microsoft/applicationinsights-web': `${window.location.origin}/static/node_modules/@microsoft/applicationinsights-web/dist/applicationinsights-web.js`,
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="./static/out/vs/loader.js"></script>
|
||||
<script>
|
||||
// NOTE: Changes to inline scripts require update of content security policy
|
||||
require(['vs/code/browser/workbench/web.main'], function (web) {
|
||||
web.main();
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
@@ -10,18 +10,19 @@
|
||||
<!-- Content Security Policy -->
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none';
|
||||
content="
|
||||
default-src 'self';
|
||||
img-src 'self' https: data: blob:;
|
||||
media-src 'none';
|
||||
script-src 'self' https://az416426.vo.msecnd.net 'unsafe-eval' https:;
|
||||
script-src 'self' https://az416426.vo.msecnd.net 'unsafe-eval' https: 'sha256-4DqvCTjCHj2KW4QxC/Yt6uBwMRyYiEg7kOoykSEkonQ=' 'sha256-kXwJWoOluR7vyWhuqykdzYEHvOuOu2ZZhnBm0EBbYvU=';
|
||||
child-src 'self';
|
||||
frame-src 'self' {{WEBVIEW_ENDPOINT}} https://*.vscode-webview-test.com;
|
||||
worker-src 'self';
|
||||
style-src 'self' 'unsafe-inline';
|
||||
connect-src 'self' ws: wss: https:;
|
||||
font-src 'self' blob:;
|
||||
manifest-src 'self';"
|
||||
>
|
||||
manifest-src 'self';
|
||||
">
|
||||
|
||||
<!-- Workbench Configuration -->
|
||||
<meta id="vscode-workbench-web-configuration" data-settings="{{WORKBENCH_WEB_CONGIGURATION}}">
|
||||
@@ -33,13 +34,39 @@
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="./static/out/vs/workbench/workbench.web.api.css">
|
||||
|
||||
<!-- Prefetch to avoid waterfall -->
|
||||
<link rel="prefetch" href="./static/node_modules/semver-umd/lib/semver-umd.js">
|
||||
<link rel="prefetch" href="./static/node_modules/onigasm-umd/release/main.js"> <!-- TODO@ben TODO@alex: should be lazy -->
|
||||
<link rel="prefetch" href="./static/node_modules/@microsoft/applicationinsights-web/dist/applicationinsights-web.js">
|
||||
</head>
|
||||
|
||||
<body aria-label="">
|
||||
</body>
|
||||
|
||||
<!-- Startup (do not modify order of script tags!) -->
|
||||
<script>
|
||||
// NOTE: Changes to inline scripts require update of content security policy
|
||||
self.require = {
|
||||
baseUrl: `${window.location.origin}/static/out`,
|
||||
paths: {
|
||||
'vscode-textmate': `${window.location.origin}/static/node_modules/vscode-textmate/release/main`,
|
||||
'onigasm-umd': `${window.location.origin}/static/node_modules/onigasm-umd/release/main`,
|
||||
'xterm': `${window.location.origin}/static/node_modules/xterm/lib/xterm.js`,
|
||||
'xterm-addon-search': `${window.location.origin}/static/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
|
||||
'xterm-addon-web-links': `${window.location.origin}/static/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
|
||||
'semver-umd': `${window.location.origin}/static/node_modules/semver-umd/lib/semver-umd.js`,
|
||||
'@microsoft/applicationinsights-web': `${window.location.origin}/static/node_modules/@microsoft/applicationinsights-web/dist/applicationinsights-web.js`,
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="./static/out/vs/loader.js"></script>
|
||||
<script src="./static/out/vs/workbench/workbench.web.api.nls.js"></script>
|
||||
<script src="./static/out/vs/code/browser/workbench/workbench.js"></script>
|
||||
<script src="./static/out/vs/workbench/workbench.web.api.js"></script>
|
||||
<script src="./static/out/vs/code/browser/workbench/web.main.js"></script>
|
||||
<script>
|
||||
require(['vs/code/browser/workbench/web.main'], function (web) {
|
||||
web.main();
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
||||
/** @type any */
|
||||
const amdLoader = require;
|
||||
|
||||
amdLoader.config({
|
||||
baseUrl: `${window.location.origin}/static/out`,
|
||||
paths: {
|
||||
'vscode-textmate': `${window.location.origin}/static/node_modules/vscode-textmate/release/main`,
|
||||
'onigasm-umd': `${window.location.origin}/static/node_modules/onigasm-umd/release/main`,
|
||||
'xterm': `${window.location.origin}/static/node_modules/xterm/lib/xterm.js`,
|
||||
'xterm-addon-search': `${window.location.origin}/static/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
|
||||
'xterm-addon-web-links': `${window.location.origin}/static/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
|
||||
'semver-umd': `${window.location.origin}/static/node_modules/semver-umd/lib/semver-umd.js`,
|
||||
'@microsoft/applicationinsights-web': `${window.location.origin}/static/node_modules/@microsoft/applicationinsights-web/dist/applicationinsights-web.js`,
|
||||
}
|
||||
});
|
||||
|
||||
amdLoader(['vs/workbench/workbench.web.api'], function (api) {
|
||||
const options = JSON.parse(document.getElementById('vscode-workbench-web-configuration').getAttribute('data-settings'));
|
||||
api.create(document.body, options);
|
||||
});
|
||||
})();
|
||||
@@ -26,7 +26,7 @@ import { IStateService } from 'vs/platform/state/common/state';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IURLService } from 'vs/platform/url/common/url';
|
||||
import { URLHandlerChannelClient, URLServiceChannel } from 'vs/platform/url/node/urlIpc';
|
||||
import { URLHandlerChannelClient, URLServiceChannel, URLHandlerRouter } from 'vs/platform/url/common/urlIpc';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryService, combinedAppender, LogAppender } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc';
|
||||
@@ -579,7 +579,8 @@ export class CodeApplication extends Disposable {
|
||||
// Create a URL handler which forwards to the last active window
|
||||
const activeWindowManager = new ActiveWindowManager(windowsService);
|
||||
const activeWindowRouter = new StaticRouter(ctx => activeWindowManager.getActiveClientId().then(id => ctx === id));
|
||||
const urlHandlerChannel = electronIpcServer.getChannel('urlHandler', activeWindowRouter);
|
||||
const urlHandlerRouter = new URLHandlerRouter(activeWindowRouter);
|
||||
const urlHandlerChannel = electronIpcServer.getChannel('urlHandler', urlHandlerRouter);
|
||||
const multiplexURLHandler = new URLHandlerChannelClient(urlHandlerChannel);
|
||||
|
||||
// On Mac, Code can be running without any open windows, so we must create a window to handle urls,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage, R
|
||||
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';
|
||||
import { parseArgs } from 'vs/platform/environment/node/argv';
|
||||
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { IWindowSettings, MenuBarVisibility, IWindowConfiguration, ReadyState, getTitleBarStyle } from 'vs/platform/windows/common/windows';
|
||||
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -574,7 +574,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
windowConfiguration.partsSplashPath = path.join(this.environmentService.userDataPath, 'rapid_render.json');
|
||||
|
||||
// Config (combination of process.argv and window configuration)
|
||||
const environment = parseArgs(process.argv);
|
||||
const environment = parseArgs(process.argv, OPTIONS);
|
||||
const config = objects.assign(environment, windowConfiguration);
|
||||
for (const key in config) {
|
||||
const configValue = (config as any)[key];
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { spawn, ChildProcess, SpawnOptions } from 'child_process';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { buildHelpMessage, buildVersionMessage, addArg, createWaitMarkerFile } from 'vs/platform/environment/node/argv';
|
||||
import { buildHelpMessage, buildVersionMessage, addArg, createWaitMarkerFile, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { parseCLIProcessArgv } from 'vs/platform/environment/node/argvHelper';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
@@ -47,7 +47,7 @@ export async function main(argv: string[]): Promise<any> {
|
||||
// Help
|
||||
if (args.help) {
|
||||
const executable = `${product.applicationName}${os.platform() === 'win32' ? '.exe' : ''}`;
|
||||
console.log(buildHelpMessage(product.nameLong, executable, pkg.version));
|
||||
console.log(buildHelpMessage(product.nameLong, executable, pkg.version, OPTIONS));
|
||||
}
|
||||
|
||||
// Version Info
|
||||
|
||||
@@ -4,29 +4,28 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { formatOptions, Option, addArg } from 'vs/platform/environment/node/argv';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
|
||||
suite('formatOptions', () => {
|
||||
|
||||
function o(id: keyof ParsedArgs, description: string): Option {
|
||||
function o(description: string): Option<any> {
|
||||
return {
|
||||
id, description, type: 'string'
|
||||
description, type: 'string'
|
||||
};
|
||||
}
|
||||
|
||||
test('Text should display small columns correctly', () => {
|
||||
assert.deepEqual(
|
||||
formatOptions([
|
||||
o('add', 'bar')
|
||||
], 80),
|
||||
formatOptions({
|
||||
'add': o('bar')
|
||||
}, 80),
|
||||
[' --add bar']
|
||||
);
|
||||
assert.deepEqual(
|
||||
formatOptions([
|
||||
o('add', 'bar'),
|
||||
o('wait', 'ba'),
|
||||
o('trace', 'b')
|
||||
], 80),
|
||||
formatOptions({
|
||||
'add': o('bar'),
|
||||
'wait': o('ba'),
|
||||
'trace': o('b')
|
||||
}, 80),
|
||||
[
|
||||
' --add bar',
|
||||
' --wait ba',
|
||||
@@ -36,9 +35,9 @@ suite('formatOptions', () => {
|
||||
|
||||
test('Text should wrap', () => {
|
||||
assert.deepEqual(
|
||||
formatOptions([
|
||||
o('add', (<any>'bar ').repeat(9))
|
||||
], 40),
|
||||
formatOptions({
|
||||
'add': o((<any>'bar ').repeat(9))
|
||||
}, 40),
|
||||
[
|
||||
' --add bar bar bar bar bar bar bar bar',
|
||||
' bar'
|
||||
@@ -47,9 +46,9 @@ suite('formatOptions', () => {
|
||||
|
||||
test('Text should revert to the condensed view when the terminal is too narrow', () => {
|
||||
assert.deepEqual(
|
||||
formatOptions([
|
||||
o('add', (<any>'bar ').repeat(9))
|
||||
], 30),
|
||||
formatOptions({
|
||||
'add': o((<any>'bar ').repeat(9))
|
||||
}, 30),
|
||||
[
|
||||
' --add',
|
||||
' bar bar bar bar bar bar bar bar bar '
|
||||
|
||||
@@ -11,7 +11,7 @@ import * as platform from 'vs/base/common/platform';
|
||||
import { CharWidthRequest, CharWidthRequestType, readCharWidths } from 'vs/editor/browser/config/charWidthReader';
|
||||
import { ElementSizeObserver } from 'vs/editor/browser/config/elementSizeObserver';
|
||||
import { CommonEditorConfiguration, IEnvConfiguration } from 'vs/editor/common/config/commonEditorConfig';
|
||||
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { IEditorOptions, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { BareFontInfo, FontInfo } from 'vs/editor/common/config/fontInfo';
|
||||
import { IDimension } from 'vs/editor/common/editorCommon';
|
||||
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
|
||||
@@ -320,7 +320,7 @@ export class Configuration extends CommonEditorConfiguration {
|
||||
|
||||
this._register(CSSBasedConfiguration.INSTANCE.onDidChange(() => this._onCSSBasedConfigurationChanged()));
|
||||
|
||||
if (this._validatedOptions.automaticLayout) {
|
||||
if (this._validatedOptions.get(EditorOption.automaticLayout)) {
|
||||
this._elementSizeObserver.startObserving();
|
||||
}
|
||||
|
||||
|
||||
@@ -343,12 +343,8 @@ export namespace CoreNavigationCommands {
|
||||
const validatedPosition = context.model.validatePosition(args.position);
|
||||
const validatedViewPosition = context.validateViewPosition(new Position(args.viewPosition.lineNumber, args.viewPosition.column), validatedPosition);
|
||||
|
||||
let fromViewLineNumber = prevColumnSelectData.fromViewLineNumber;
|
||||
let fromViewVisualColumn = prevColumnSelectData.fromViewVisualColumn;
|
||||
if (!prevColumnSelectData.isReal && args.setAnchorIfNotSet) {
|
||||
fromViewLineNumber = validatedViewPosition.lineNumber;
|
||||
fromViewVisualColumn = args.mouseColumn - 1;
|
||||
}
|
||||
let fromViewLineNumber = args.doColumnSelect ? prevColumnSelectData.fromViewLineNumber : validatedViewPosition.lineNumber;
|
||||
let fromViewVisualColumn = args.doColumnSelect ? prevColumnSelectData.fromViewVisualColumn : args.mouseColumn - 1;
|
||||
return ColumnSelection.columnSelect(context.config, context.viewModel, fromViewLineNumber, fromViewVisualColumn, validatedViewPosition.lineNumber, args.mouseColumn - 1);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -21,6 +21,8 @@ import { HorizontalRange } from 'vs/editor/common/view/renderingContext';
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { ViewEventHandler } from 'vs/editor/common/viewModel/viewEventHandler';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
/**
|
||||
* Merges mouse events when mouse move events are throttled
|
||||
@@ -111,7 +113,7 @@ export class MouseHandler extends ViewEventHandler {
|
||||
const onMouseWheel = (browserEvent: IMouseWheelEvent) => {
|
||||
this.viewController.emitMouseWheel(browserEvent);
|
||||
|
||||
if (!this._context.configuration.editor.viewInfo.mouseWheelZoom) {
|
||||
if (!this._context.configuration.options.get(EditorOption.mouseWheelZoom)) {
|
||||
return;
|
||||
}
|
||||
const e = new StandardWheelEvent(browserEvent);
|
||||
@@ -216,7 +218,7 @@ export class MouseHandler extends ViewEventHandler {
|
||||
const targetIsContent = (t.type === editorBrowser.MouseTargetType.CONTENT_TEXT || t.type === editorBrowser.MouseTargetType.CONTENT_EMPTY);
|
||||
const targetIsGutter = (t.type === editorBrowser.MouseTargetType.GUTTER_GLYPH_MARGIN || t.type === editorBrowser.MouseTargetType.GUTTER_LINE_NUMBERS || t.type === editorBrowser.MouseTargetType.GUTTER_LINE_DECORATIONS);
|
||||
const targetIsLineNumbers = (t.type === editorBrowser.MouseTargetType.GUTTER_LINE_NUMBERS);
|
||||
const selectOnLineNumbers = this._context.configuration.editor.viewInfo.selectOnLineNumbers;
|
||||
const selectOnLineNumbers = this._context.configuration.options.get(EditorOption.selectOnLineNumbers);
|
||||
const targetIsViewZone = (t.type === editorBrowser.MouseTargetType.CONTENT_VIEW_ZONE || t.type === editorBrowser.MouseTargetType.GUTTER_VIEW_ZONE);
|
||||
const targetIsWidget = (t.type === editorBrowser.MouseTargetType.CONTENT_WIDGET);
|
||||
|
||||
@@ -351,8 +353,10 @@ class MouseDownOperation extends Disposable {
|
||||
// Overwrite the detail of the MouseEvent, as it will be sent out in an event and contributions might rely on it.
|
||||
e.detail = this._mouseState.count;
|
||||
|
||||
if (!this._context.configuration.editor.readOnly
|
||||
&& this._context.configuration.editor.dragAndDrop
|
||||
const options = this._context.configuration.options;
|
||||
|
||||
if (!options.get(EditorOption.readOnly)
|
||||
&& options.get(EditorOption.dragAndDrop)
|
||||
&& !this._mouseState.altKey // we don't support multiple mouse
|
||||
&& e.detail < 2 // only single click on a selection can work
|
||||
&& !this._isActive // the mouse is not down yet
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ClientCoordinates, EditorMouseEvent, EditorPagePosition, PageCoordinate
|
||||
import { PartFingerprint, PartFingerprints } from 'vs/editor/browser/view/viewPart';
|
||||
import { ViewLine } from 'vs/editor/browser/viewParts/lines/viewLine';
|
||||
import { IViewCursorRenderData } from 'vs/editor/browser/viewParts/viewCursors/viewCursor';
|
||||
import { EditorLayoutInfo } from 'vs/editor/common/config/editorOptions';
|
||||
import { EditorLayoutInfo, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range as EditorRange } from 'vs/editor/common/core/range';
|
||||
import { HorizontalRange } from 'vs/editor/common/view/renderingContext';
|
||||
@@ -239,10 +239,11 @@ export class HitTestContext {
|
||||
|
||||
constructor(context: ViewContext, viewHelper: IPointerHandlerHelper, lastViewCursorsRenderData: IViewCursorRenderData[]) {
|
||||
this.model = context.model;
|
||||
this.layoutInfo = context.configuration.editor.layoutInfo;
|
||||
const options = context.configuration.options;
|
||||
this.layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this.viewDomNode = viewHelper.viewDomNode;
|
||||
this.lineHeight = context.configuration.editor.lineHeight;
|
||||
this.typicalHalfwidthCharacterWidth = context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
this.lineHeight = options.get(EditorOption.lineHeight);
|
||||
this.typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;
|
||||
this.lastViewCursorsRenderData = lastViewCursorsRenderData;
|
||||
this._context = context;
|
||||
this._viewHelper = viewHelper;
|
||||
@@ -713,9 +714,10 @@ export class MouseTargetFactory {
|
||||
}
|
||||
|
||||
public getMouseColumn(editorPos: EditorPagePosition, pos: PageCoordinates): number {
|
||||
const layoutInfo = this._context.configuration.editor.layoutInfo;
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
const mouseContentHorizontalOffset = this._context.viewLayout.getCurrentScrollLeft() + pos.x - editorPos.x - layoutInfo.contentLeft;
|
||||
return MouseTargetFactory._getMouseColumn(mouseContentHorizontalOffset, this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth);
|
||||
return MouseTargetFactory._getMouseColumn(mouseContentHorizontalOffset, options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth);
|
||||
}
|
||||
|
||||
public static _getMouseColumn(mouseContentHorizontalOffset: number, typicalHalfwidthCharacterWidth: number): number {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./textAreaHandler';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
|
||||
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
@@ -16,7 +17,7 @@ import { ViewController } from 'vs/editor/browser/view/viewController';
|
||||
import { PartFingerprint, PartFingerprints, ViewPart } from 'vs/editor/browser/view/viewPart';
|
||||
import { LineNumbersOverlay } from 'vs/editor/browser/viewParts/lineNumbers/lineNumbers';
|
||||
import { Margin } from 'vs/editor/browser/viewParts/margin/margin';
|
||||
import { RenderLineNumbersType } from 'vs/editor/common/config/editorOptions';
|
||||
import { RenderLineNumbersType, EditorOption, IComputedEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { BareFontInfo } from 'vs/editor/common/config/fontInfo';
|
||||
import { WordCharacterClass, getMapForWordSeparators } from 'vs/editor/common/controller/wordCharacterClassifier';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
@@ -91,12 +92,13 @@ export class TextAreaHandler extends ViewPart {
|
||||
|
||||
private readonly _viewController: ViewController;
|
||||
private readonly _viewHelper: ITextAreaHandlerHelper;
|
||||
private _scrollLeft: number;
|
||||
private _scrollTop: number;
|
||||
|
||||
private _accessibilitySupport: AccessibilitySupport;
|
||||
private _contentLeft: number;
|
||||
private _contentWidth: number;
|
||||
private _contentHeight: number;
|
||||
private _scrollLeft: number;
|
||||
private _scrollTop: number;
|
||||
private _fontInfo: BareFontInfo;
|
||||
private _lineHeight: number;
|
||||
private _emptySelectionClipboard: boolean;
|
||||
@@ -117,19 +119,20 @@ export class TextAreaHandler extends ViewPart {
|
||||
|
||||
this._viewController = viewController;
|
||||
this._viewHelper = viewHelper;
|
||||
|
||||
const conf = this._context.configuration.editor;
|
||||
|
||||
this._accessibilitySupport = conf.accessibilitySupport;
|
||||
this._contentLeft = conf.layoutInfo.contentLeft;
|
||||
this._contentWidth = conf.layoutInfo.contentWidth;
|
||||
this._contentHeight = conf.layoutInfo.contentHeight;
|
||||
this._scrollLeft = 0;
|
||||
this._scrollTop = 0;
|
||||
this._fontInfo = conf.fontInfo;
|
||||
this._lineHeight = conf.lineHeight;
|
||||
this._emptySelectionClipboard = conf.emptySelectionClipboard;
|
||||
this._copyWithSyntaxHighlighting = conf.copyWithSyntaxHighlighting;
|
||||
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._accessibilitySupport = options.get(EditorOption.accessibilitySupport);
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
this._contentHeight = layoutInfo.contentHeight;
|
||||
this._fontInfo = options.get(EditorOption.fontInfo);
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._emptySelectionClipboard = options.get(EditorOption.emptySelectionClipboard);
|
||||
this._copyWithSyntaxHighlighting = options.get(EditorOption.copyWithSyntaxHighlighting);
|
||||
|
||||
this._visibleTextArea = null;
|
||||
this._selections = [new Selection(1, 1, 1, 1)];
|
||||
@@ -143,7 +146,7 @@ export class TextAreaHandler extends ViewPart {
|
||||
this.textArea.setAttribute('autocapitalize', 'off');
|
||||
this.textArea.setAttribute('autocomplete', 'off');
|
||||
this.textArea.setAttribute('spellcheck', 'false');
|
||||
this.textArea.setAttribute('aria-label', conf.viewInfo.ariaLabel);
|
||||
this.textArea.setAttribute('aria-label', this._getAriaLabel(options));
|
||||
this.textArea.setAttribute('role', 'textbox');
|
||||
this.textArea.setAttribute('aria-multiline', 'true');
|
||||
this.textArea.setAttribute('aria-haspopup', 'false');
|
||||
@@ -341,7 +344,7 @@ export class TextAreaHandler extends ViewPart {
|
||||
|
||||
private _getWordBeforePosition(position: Position): string {
|
||||
const lineContent = this._context.model.getLineContent(position.lineNumber);
|
||||
const wordSeparators = getMapForWordSeparators(this._context.configuration.editor.wordSeparators);
|
||||
const wordSeparators = getMapForWordSeparators(this._context.configuration.options.get(EditorOption.wordSeparators));
|
||||
|
||||
let column = position.column;
|
||||
let distance = 0;
|
||||
@@ -368,35 +371,33 @@ export class TextAreaHandler extends ViewPart {
|
||||
return '';
|
||||
}
|
||||
|
||||
private _getAriaLabel(options: IComputedEditorOptions): string {
|
||||
const accessibilitySupport = options.get(EditorOption.accessibilitySupport);
|
||||
if (accessibilitySupport === AccessibilitySupport.Disabled) {
|
||||
return nls.localize('accessibilityOffAriaLabel', "The editor is not accessible at this time. Press Alt+F1 for options.");
|
||||
}
|
||||
return options.get(EditorOption.ariaLabel);
|
||||
}
|
||||
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
const conf = this._context.configuration.editor;
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
if (e.fontInfo) {
|
||||
this._fontInfo = conf.fontInfo;
|
||||
}
|
||||
if (e.viewInfo) {
|
||||
this.textArea.setAttribute('aria-label', conf.viewInfo.ariaLabel);
|
||||
}
|
||||
if (e.layoutInfo) {
|
||||
this._contentLeft = conf.layoutInfo.contentLeft;
|
||||
this._contentWidth = conf.layoutInfo.contentWidth;
|
||||
this._contentHeight = conf.layoutInfo.contentHeight;
|
||||
}
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = conf.lineHeight;
|
||||
}
|
||||
if (e.accessibilitySupport) {
|
||||
this._accessibilitySupport = conf.accessibilitySupport;
|
||||
this._accessibilitySupport = options.get(EditorOption.accessibilitySupport);
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
this._contentHeight = layoutInfo.contentHeight;
|
||||
this._fontInfo = options.get(EditorOption.fontInfo);
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._emptySelectionClipboard = options.get(EditorOption.emptySelectionClipboard);
|
||||
this._copyWithSyntaxHighlighting = options.get(EditorOption.copyWithSyntaxHighlighting);
|
||||
this.textArea.setAttribute('aria-label', this._getAriaLabel(options));
|
||||
|
||||
if (e.hasChanged(EditorOption.accessibilitySupport)) {
|
||||
this._textAreaInput.writeScreenReaderContent('strategy changed');
|
||||
}
|
||||
if (e.emptySelectionClipboard) {
|
||||
this._emptySelectionClipboard = conf.emptySelectionClipboard;
|
||||
}
|
||||
if (e.copyWithSyntaxHighlighting) {
|
||||
this._copyWithSyntaxHighlighting = conf.copyWithSyntaxHighlighting;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -545,10 +546,12 @@ export class TextAreaHandler extends ViewPart {
|
||||
tac.setWidth(1);
|
||||
tac.setHeight(1);
|
||||
|
||||
if (this._context.configuration.editor.viewInfo.glyphMargin) {
|
||||
const options = this._context.configuration.options;
|
||||
|
||||
if (options.get(EditorOption.glyphMargin)) {
|
||||
tac.setClassName('monaco-editor-background textAreaCover ' + Margin.OUTER_CLASS_NAME);
|
||||
} else {
|
||||
if (this._context.configuration.editor.viewInfo.renderLineNumbers !== RenderLineNumbersType.Off) {
|
||||
if (options.get(EditorOption.lineNumbers).renderType !== RenderLineNumbersType.Off) {
|
||||
tac.setClassName('monaco-editor-background textAreaCover ' + LineNumbersOverlay.CLASS_NAME);
|
||||
} else {
|
||||
tac.setClassName('monaco-editor-background textAreaCover');
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { IMouseEvent, IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as editorOptions from 'vs/editor/common/config/editorOptions';
|
||||
import { OverviewRulerPosition, ConfigurationChangedEvent, EditorLayoutInfo, IComputedEditorOptions, EditorOption, FindComputedEditorOptionValueById, IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { ICursors } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { ICursorPositionChangedEvent, ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
|
||||
import { IPosition, Position } from 'vs/editor/common/core/position';
|
||||
@@ -315,7 +315,7 @@ export interface IOverviewRuler {
|
||||
getDomNode(): HTMLElement;
|
||||
dispose(): void;
|
||||
setZones(zones: OverviewRulerZone[]): void;
|
||||
setLayout(position: editorOptions.OverviewRulerPosition): void;
|
||||
setLayout(position: OverviewRulerPosition): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -351,7 +351,7 @@ export interface ICodeEditor extends editorCommon.IEditor {
|
||||
* An event emitted when the configuration of the editor has changed. (e.g. `editor.updateOptions()`)
|
||||
* @event
|
||||
*/
|
||||
onDidChangeConfiguration(listener: (e: editorOptions.IConfigurationChangedEvent) => void): IDisposable;
|
||||
onDidChangeConfiguration(listener: (e: ConfigurationChangedEvent) => void): IDisposable;
|
||||
/**
|
||||
* An event emitted when the cursor position has changed.
|
||||
* @event
|
||||
@@ -481,7 +481,7 @@ export interface ICodeEditor extends editorCommon.IEditor {
|
||||
* An event emitted when the layout of the editor has changed.
|
||||
* @event
|
||||
*/
|
||||
onDidLayoutChange(listener: (e: editorOptions.EditorLayoutInfo) => void): IDisposable;
|
||||
onDidLayoutChange(listener: (e: EditorLayoutInfo) => void): IDisposable;
|
||||
/**
|
||||
* An event emitted when the scroll in the editor has changed.
|
||||
* @event
|
||||
@@ -532,15 +532,19 @@ export interface ICodeEditor extends editorCommon.IEditor {
|
||||
setModel(model: ITextModel | null): void;
|
||||
|
||||
/**
|
||||
* Returns the current editor's configuration
|
||||
*/
|
||||
getConfiguration(): editorOptions.InternalEditorOptions;
|
||||
|
||||
/**
|
||||
* Returns the 'raw' editor's configuration (without any validation or defaults).
|
||||
* @internal
|
||||
*/
|
||||
getRawConfiguration(): editorOptions.IEditorOptions;
|
||||
getOptions(): IComputedEditorOptions;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
getOption<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T>;
|
||||
|
||||
/**
|
||||
* Returns the editor's configuration (without any validation or defaults).
|
||||
*/
|
||||
getRawOptions(): IEditorOptions;
|
||||
|
||||
/**
|
||||
* Get value of the current model attached to this editor.
|
||||
@@ -655,7 +659,7 @@ export interface ICodeEditor extends editorCommon.IEditor {
|
||||
/**
|
||||
* Get the layout info for the editor.
|
||||
*/
|
||||
getLayoutInfo(): editorOptions.EditorLayoutInfo;
|
||||
getLayoutInfo(): EditorLayoutInfo;
|
||||
|
||||
/**
|
||||
* Returns the ranges that are currently visible.
|
||||
|
||||
@@ -12,6 +12,7 @@ import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { IConfiguration } from 'vs/editor/common/editorCommon';
|
||||
import { IViewModel } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
export interface IMouseDispatchData {
|
||||
position: Position;
|
||||
@@ -107,7 +108,7 @@ export class ViewController {
|
||||
}
|
||||
|
||||
private _hasMulticursorModifier(data: IMouseDispatchData): boolean {
|
||||
switch (this.configuration.editor.multiCursorModifier) {
|
||||
switch (this.configuration.options.get(EditorOption.multiCursorModifier)) {
|
||||
case 'altKey':
|
||||
return data.altKey;
|
||||
case 'ctrlKey':
|
||||
@@ -119,7 +120,7 @@ export class ViewController {
|
||||
}
|
||||
|
||||
private _hasNonMulticursorModifier(data: IMouseDispatchData): boolean {
|
||||
switch (this.configuration.editor.multiCursorModifier) {
|
||||
switch (this.configuration.options.get(EditorOption.multiCursorModifier)) {
|
||||
case 'altKey':
|
||||
return data.ctrlKey || data.metaKey;
|
||||
case 'ctrlKey':
|
||||
@@ -132,11 +133,7 @@ export class ViewController {
|
||||
|
||||
public dispatchMouse(data: IMouseDispatchData): void {
|
||||
if (data.middleButton) {
|
||||
if (data.inSelectionMode) {
|
||||
this._columnSelect(data.position, data.mouseColumn, true);
|
||||
} else {
|
||||
this.moveTo(data.position);
|
||||
}
|
||||
this._columnSelect(data.position, data.mouseColumn, data.inSelectionMode);
|
||||
} else if (data.startedOnLineNumbers) {
|
||||
// If the dragging started on the gutter, then have operations work on the entire line
|
||||
if (this._hasMulticursorModifier(data)) {
|
||||
@@ -182,7 +179,7 @@ export class ViewController {
|
||||
if (this._hasMulticursorModifier(data)) {
|
||||
if (!this._hasNonMulticursorModifier(data)) {
|
||||
if (data.shiftKey) {
|
||||
this._columnSelect(data.position, data.mouseColumn, false);
|
||||
this._columnSelect(data.position, data.mouseColumn, true);
|
||||
} else {
|
||||
// Do multi-cursor operations only when purely alt is pressed
|
||||
if (data.inSelectionMode) {
|
||||
@@ -222,13 +219,13 @@ export class ViewController {
|
||||
this._execMouseCommand(CoreNavigationCommands.MoveToSelect, this._usualArgs(viewPosition));
|
||||
}
|
||||
|
||||
private _columnSelect(viewPosition: Position, mouseColumn: number, setAnchorIfNotSet: boolean): void {
|
||||
private _columnSelect(viewPosition: Position, mouseColumn: number, doColumnSelect: boolean): void {
|
||||
viewPosition = this._validateViewColumn(viewPosition);
|
||||
this._execMouseCommand(CoreNavigationCommands.ColumnSelect, {
|
||||
position: this._convertViewToModelPosition(viewPosition),
|
||||
viewPosition: viewPosition,
|
||||
mouseColumn: mouseColumn,
|
||||
setAnchorIfNotSet: setAnchorIfNotSet
|
||||
doColumnSelect: doColumnSelect
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData'
|
||||
import { ViewEventHandler } from 'vs/editor/common/viewModel/viewEventHandler';
|
||||
import { IViewModel } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { IThemeService, getThemeTypeSelector } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
export interface IContentWidgetData {
|
||||
widget: editorBrowser.IContentWidget;
|
||||
@@ -218,7 +220,7 @@ export class View extends ViewEventHandler {
|
||||
this.domNode.appendChild(this.overflowGuardContainer);
|
||||
this.domNode.appendChild(this.contentWidgets.overflowingContentWidgetsDomNode);
|
||||
|
||||
this._setLayout();
|
||||
this._applyLayout();
|
||||
|
||||
// Pointer handler
|
||||
this.pointerHandler = this._register(new PointerHandler(this._context, viewController, this.createPointerHandlerHelper()));
|
||||
@@ -280,8 +282,10 @@ export class View extends ViewEventHandler {
|
||||
};
|
||||
}
|
||||
|
||||
private _setLayout(): void {
|
||||
const layoutInfo = this._context.configuration.editor.layoutInfo;
|
||||
private _applyLayout(): void {
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this.domNode.setWidth(layoutInfo.width);
|
||||
this.domNode.setHeight(layoutInfo.height);
|
||||
|
||||
@@ -290,23 +294,18 @@ export class View extends ViewEventHandler {
|
||||
|
||||
this.linesContent.setWidth(1000000);
|
||||
this.linesContent.setHeight(1000000);
|
||||
|
||||
}
|
||||
|
||||
private getEditorClassName() {
|
||||
const focused = this._textAreaHandler.isFocused() ? ' focused' : '';
|
||||
return this._context.configuration.editor.editorClassName + ' ' + getThemeTypeSelector(this._context.theme.type) + focused;
|
||||
return this._context.configuration.options.get(EditorOption.editorClassName) + ' ' + getThemeTypeSelector(this._context.theme.type) + focused;
|
||||
}
|
||||
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.editorClassName) {
|
||||
this.domNode.setClassName(this.getEditorClassName());
|
||||
}
|
||||
if (e.layoutInfo) {
|
||||
this._setLayout();
|
||||
}
|
||||
this.domNode.setClassName(this.getEditorClassName());
|
||||
this._applyLayout();
|
||||
return false;
|
||||
}
|
||||
public onFocusChanged(e: viewEvents.ViewFocusChangedEvent): boolean {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
|
||||
import { IStringBuilder, createStringBuilder } from 'vs/editor/common/core/stringBuilder';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
/**
|
||||
* Represents a visible line
|
||||
@@ -269,7 +270,10 @@ export class VisibleLinesCollection<T extends IVisibleLine> {
|
||||
// ---- begin view event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
return e.layoutInfo;
|
||||
if (e.hasChanged(EditorOption.layoutInfo)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public onFlushed(e: viewEvents.ViewFlushedEvent): boolean {
|
||||
|
||||
@@ -14,6 +14,8 @@ import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/v
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
export class ViewOverlays extends ViewPart implements IVisibleLinesHost<ViewOverlayLine> {
|
||||
|
||||
@@ -147,7 +149,7 @@ export class ViewOverlayLine implements IVisibleLine {
|
||||
|
||||
constructor(configuration: IConfiguration, dynamicOverlays: DynamicViewOverlay[]) {
|
||||
this._configuration = configuration;
|
||||
this._lineHeight = this._configuration.editor.lineHeight;
|
||||
this._lineHeight = this._configuration.options.get(EditorOption.lineHeight);
|
||||
this._dynamicOverlays = dynamicOverlays;
|
||||
|
||||
this._domNode = null;
|
||||
@@ -171,9 +173,7 @@ export class ViewOverlayLine implements IVisibleLine {
|
||||
// Nothing
|
||||
}
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): void {
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = this._configuration.editor.lineHeight;
|
||||
}
|
||||
this._lineHeight = this._configuration.options.get(EditorOption.lineHeight);
|
||||
}
|
||||
|
||||
public renderLine(lineNumber: number, deltaTop: number, viewportData: ViewportData, sb: IStringBuilder): boolean {
|
||||
@@ -215,8 +215,9 @@ export class ContentViewOverlays extends ViewOverlays {
|
||||
|
||||
constructor(context: ViewContext) {
|
||||
super(context);
|
||||
|
||||
this._contentWidth = this._context.configuration.editor.layoutInfo.contentWidth;
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
|
||||
this.domNode.setHeight(0);
|
||||
}
|
||||
@@ -224,10 +225,10 @@ export class ContentViewOverlays extends ViewOverlays {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.layoutInfo) {
|
||||
this._contentWidth = this._context.configuration.editor.layoutInfo.contentWidth;
|
||||
}
|
||||
return super.onConfigurationChanged(e);
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
return super.onConfigurationChanged(e) || true;
|
||||
}
|
||||
public onScrollChanged(e: viewEvents.ViewScrollChangedEvent): boolean {
|
||||
return super.onScrollChanged(e) || e.scrollWidthChanged;
|
||||
@@ -249,25 +250,22 @@ export class MarginViewOverlays extends ViewOverlays {
|
||||
constructor(context: ViewContext) {
|
||||
super(context);
|
||||
|
||||
this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
|
||||
this.domNode.setClassName('margin-view-overlays');
|
||||
this.domNode.setWidth(1);
|
||||
|
||||
Configuration.applyFontInfo(this.domNode, this._context.configuration.editor.fontInfo);
|
||||
Configuration.applyFontInfo(this.domNode, options.get(EditorOption.fontInfo));
|
||||
}
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
let shouldRender = false;
|
||||
if (e.fontInfo) {
|
||||
Configuration.applyFontInfo(this.domNode, this._context.configuration.editor.fontInfo);
|
||||
shouldRender = true;
|
||||
}
|
||||
if (e.layoutInfo) {
|
||||
this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
|
||||
shouldRender = true;
|
||||
}
|
||||
return super.onConfigurationChanged(e) || shouldRender;
|
||||
const options = this._context.configuration.options;
|
||||
Configuration.applyFontInfo(this.domNode, options.get(EditorOption.fontInfo));
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
return super.onConfigurationChanged(e) || true;
|
||||
}
|
||||
|
||||
public onScrollChanged(e: viewEvents.ViewScrollChangedEvent): boolean {
|
||||
|
||||
@@ -14,6 +14,8 @@ import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/v
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
class Coordinate {
|
||||
_coordinateBrand: void;
|
||||
@@ -207,10 +209,13 @@ class Widget {
|
||||
this.allowEditorOverflow = this._actual.allowEditorOverflow || false;
|
||||
this.suppressMouseDown = this._actual.suppressMouseDown || false;
|
||||
|
||||
this._fixedOverflowWidgets = this._context.configuration.editor.viewInfo.fixedOverflowWidgets;
|
||||
this._contentWidth = this._context.configuration.editor.layoutInfo.contentWidth;
|
||||
this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._fixedOverflowWidgets = options.get(EditorOption.fixedOverflowWidgets);
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
|
||||
this._position = null;
|
||||
this._range = null;
|
||||
@@ -230,12 +235,12 @@ class Widget {
|
||||
}
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): void {
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
}
|
||||
if (e.layoutInfo) {
|
||||
this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
|
||||
this._contentWidth = this._context.configuration.editor.layoutInfo.contentWidth;
|
||||
const options = this._context.configuration.options;
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
if (e.hasChanged(EditorOption.layoutInfo)) {
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
this._maxWidth = this._getMaxWidth();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,26 +10,33 @@ import { RenderingContext } from 'vs/editor/common/view/renderingContext';
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
export class CurrentLineHighlightOverlay extends DynamicViewOverlay {
|
||||
private readonly _context: ViewContext;
|
||||
private _lineHeight: number;
|
||||
private _renderLineHighlight: 'none' | 'gutter' | 'line' | 'all';
|
||||
private _contentWidth: number;
|
||||
private _selectionIsEmpty: boolean;
|
||||
private _primaryCursorLineNumber: number;
|
||||
private _scrollWidth: number;
|
||||
private _contentWidth: number;
|
||||
|
||||
constructor(context: ViewContext) {
|
||||
super();
|
||||
this._context = context;
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
this._renderLineHighlight = this._context.configuration.editor.viewInfo.renderLineHighlight;
|
||||
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._renderLineHighlight = options.get(EditorOption.renderLineHighlight);
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
|
||||
this._selectionIsEmpty = true;
|
||||
this._primaryCursorLineNumber = 1;
|
||||
this._scrollWidth = 0;
|
||||
this._contentWidth = this._context.configuration.editor.layoutInfo.contentWidth;
|
||||
|
||||
|
||||
this._context.addEventHandler(this);
|
||||
}
|
||||
@@ -42,15 +49,12 @@ export class CurrentLineHighlightOverlay extends DynamicViewOverlay {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
}
|
||||
if (e.viewInfo) {
|
||||
this._renderLineHighlight = this._context.configuration.editor.viewInfo.renderLineHighlight;
|
||||
}
|
||||
if (e.layoutInfo) {
|
||||
this._contentWidth = this._context.configuration.editor.layoutInfo.contentWidth;
|
||||
}
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._renderLineHighlight = options.get(EditorOption.renderLineHighlight);
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
return true;
|
||||
}
|
||||
public onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean {
|
||||
|
||||
+16
-13
@@ -10,24 +10,30 @@ import { RenderingContext } from 'vs/editor/common/view/renderingContext';
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
export class CurrentLineMarginHighlightOverlay extends DynamicViewOverlay {
|
||||
private readonly _context: ViewContext;
|
||||
private _lineHeight: number;
|
||||
private _renderLineHighlight: 'none' | 'gutter' | 'line' | 'all';
|
||||
private _contentLeft: number;
|
||||
private _selectionIsEmpty: boolean;
|
||||
private _primaryCursorLineNumber: number;
|
||||
private _contentLeft: number;
|
||||
|
||||
constructor(context: ViewContext) {
|
||||
super();
|
||||
this._context = context;
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
this._renderLineHighlight = this._context.configuration.editor.viewInfo.renderLineHighlight;
|
||||
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._renderLineHighlight = options.get(EditorOption.renderLineHighlight);
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
|
||||
this._selectionIsEmpty = true;
|
||||
this._primaryCursorLineNumber = 1;
|
||||
this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
|
||||
|
||||
this._context.addEventHandler(this);
|
||||
}
|
||||
@@ -40,15 +46,12 @@ export class CurrentLineMarginHighlightOverlay extends DynamicViewOverlay {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
}
|
||||
if (e.viewInfo) {
|
||||
this._renderLineHighlight = this._context.configuration.editor.viewInfo.renderLineHighlight;
|
||||
}
|
||||
if (e.layoutInfo) {
|
||||
this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
|
||||
}
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._renderLineHighlight = options.get(EditorOption.renderLineHighlight);
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
return true;
|
||||
}
|
||||
public onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean {
|
||||
|
||||
@@ -10,6 +10,7 @@ import { HorizontalRange, RenderingContext } from 'vs/editor/common/view/renderi
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { ViewModelDecoration } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
export class DecorationsOverlay extends DynamicViewOverlay {
|
||||
|
||||
@@ -21,8 +22,9 @@ export class DecorationsOverlay extends DynamicViewOverlay {
|
||||
constructor(context: ViewContext) {
|
||||
super();
|
||||
this._context = context;
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
this._typicalHalfwidthCharacterWidth = this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
const options = this._context.configuration.options;
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;
|
||||
this._renderResult = null;
|
||||
|
||||
this._context.addEventHandler(this);
|
||||
@@ -37,12 +39,9 @@ export class DecorationsOverlay extends DynamicViewOverlay {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
}
|
||||
if (e.fontInfo) {
|
||||
this._typicalHalfwidthCharacterWidth = this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
}
|
||||
const options = this._context.configuration.options;
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;
|
||||
return true;
|
||||
}
|
||||
public onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean {
|
||||
|
||||
@@ -14,6 +14,7 @@ import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/v
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { getThemeTypeSelector } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
export class EditorScrollbar extends ViewPart {
|
||||
|
||||
@@ -28,8 +29,11 @@ export class EditorScrollbar extends ViewPart {
|
||||
) {
|
||||
super(context);
|
||||
|
||||
const editor = this._context.configuration.editor;
|
||||
const configScrollbarOpts = editor.viewInfo.scrollbar;
|
||||
|
||||
const options = this._context.configuration.options;
|
||||
const scrollbar = options.get(EditorOption.scrollbar);
|
||||
const mouseWheelScrollSensitivity = options.get(EditorOption.mouseWheelScrollSensitivity);
|
||||
const fastScrollSensitivity = options.get(EditorOption.fastScrollSensitivity);
|
||||
|
||||
const scrollbarOptions: ScrollableElementCreationOptions = {
|
||||
listenOnDomNode: viewDomNode.domNode,
|
||||
@@ -37,18 +41,18 @@ export class EditorScrollbar extends ViewPart {
|
||||
useShadows: false,
|
||||
lazyRender: true,
|
||||
|
||||
vertical: configScrollbarOpts.vertical,
|
||||
horizontal: configScrollbarOpts.horizontal,
|
||||
verticalHasArrows: configScrollbarOpts.verticalHasArrows,
|
||||
horizontalHasArrows: configScrollbarOpts.horizontalHasArrows,
|
||||
verticalScrollbarSize: configScrollbarOpts.verticalScrollbarSize,
|
||||
verticalSliderSize: configScrollbarOpts.verticalSliderSize,
|
||||
horizontalScrollbarSize: configScrollbarOpts.horizontalScrollbarSize,
|
||||
horizontalSliderSize: configScrollbarOpts.horizontalSliderSize,
|
||||
handleMouseWheel: configScrollbarOpts.handleMouseWheel,
|
||||
arrowSize: configScrollbarOpts.arrowSize,
|
||||
mouseWheelScrollSensitivity: configScrollbarOpts.mouseWheelScrollSensitivity,
|
||||
fastScrollSensitivity: configScrollbarOpts.fastScrollSensitivity,
|
||||
vertical: scrollbar.vertical,
|
||||
horizontal: scrollbar.horizontal,
|
||||
verticalHasArrows: scrollbar.verticalHasArrows,
|
||||
horizontalHasArrows: scrollbar.horizontalHasArrows,
|
||||
verticalScrollbarSize: scrollbar.verticalScrollbarSize,
|
||||
verticalSliderSize: scrollbar.verticalSliderSize,
|
||||
horizontalScrollbarSize: scrollbar.horizontalScrollbarSize,
|
||||
horizontalSliderSize: scrollbar.horizontalSliderSize,
|
||||
handleMouseWheel: scrollbar.handleMouseWheel,
|
||||
arrowSize: scrollbar.arrowSize,
|
||||
mouseWheelScrollSensitivity: mouseWheelScrollSensitivity,
|
||||
fastScrollSensitivity: fastScrollSensitivity,
|
||||
};
|
||||
|
||||
this.scrollbar = this._register(new SmoothScrollableElement(linesContent.domNode, scrollbarOptions, this._context.viewLayout.scrollable));
|
||||
@@ -96,11 +100,13 @@ export class EditorScrollbar extends ViewPart {
|
||||
}
|
||||
|
||||
private _setLayout(): void {
|
||||
const layoutInfo = this._context.configuration.editor.layoutInfo;
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this.scrollbarDomNode.setLeft(layoutInfo.contentLeft);
|
||||
|
||||
const side = this._context.configuration.editor.viewInfo.minimap.side;
|
||||
const minimap = options.get(EditorOption.minimap);
|
||||
const side = minimap.side;
|
||||
if (side === 'right') {
|
||||
this.scrollbarDomNode.setWidth(layoutInfo.contentWidth + layoutInfo.minimapWidth);
|
||||
} else {
|
||||
@@ -124,16 +130,23 @@ export class EditorScrollbar extends ViewPart {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.viewInfo) {
|
||||
const editor = this._context.configuration.editor;
|
||||
if (
|
||||
e.hasChanged(EditorOption.scrollbar)
|
||||
|| e.hasChanged(EditorOption.mouseWheelScrollSensitivity)
|
||||
|| e.hasChanged(EditorOption.fastScrollSensitivity)
|
||||
) {
|
||||
const options = this._context.configuration.options;
|
||||
const scrollbar = options.get(EditorOption.scrollbar);
|
||||
const mouseWheelScrollSensitivity = options.get(EditorOption.mouseWheelScrollSensitivity);
|
||||
const fastScrollSensitivity = options.get(EditorOption.fastScrollSensitivity);
|
||||
const newOpts: ScrollableElementChangeOptions = {
|
||||
handleMouseWheel: editor.viewInfo.scrollbar.handleMouseWheel,
|
||||
mouseWheelScrollSensitivity: editor.viewInfo.scrollbar.mouseWheelScrollSensitivity,
|
||||
fastScrollSensitivity: editor.viewInfo.scrollbar.fastScrollSensitivity
|
||||
handleMouseWheel: scrollbar.handleMouseWheel,
|
||||
mouseWheelScrollSensitivity: mouseWheelScrollSensitivity,
|
||||
fastScrollSensitivity: fastScrollSensitivity
|
||||
};
|
||||
this.scrollbar.updateOptions(newOpts);
|
||||
}
|
||||
if (e.layoutInfo) {
|
||||
if (e.hasChanged(EditorOption.layoutInfo)) {
|
||||
this._setLayout();
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -8,6 +8,8 @@ import { DynamicViewOverlay } from 'vs/editor/browser/view/dynamicViewOverlay';
|
||||
import { RenderingContext } from 'vs/editor/common/view/renderingContext';
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
export class DecorationToRender {
|
||||
_decorationToRenderBrand: void;
|
||||
@@ -84,10 +86,14 @@ export class GlyphMarginOverlay extends DedupOverlay {
|
||||
constructor(context: ViewContext) {
|
||||
super();
|
||||
this._context = context;
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
this._glyphMargin = this._context.configuration.editor.viewInfo.glyphMargin;
|
||||
this._glyphMarginLeft = this._context.configuration.editor.layoutInfo.glyphMarginLeft;
|
||||
this._glyphMarginWidth = this._context.configuration.editor.layoutInfo.glyphMarginWidth;
|
||||
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._glyphMargin = options.get(EditorOption.glyphMargin);
|
||||
this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
|
||||
this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
|
||||
this._renderResult = null;
|
||||
this._context.addEventHandler(this);
|
||||
}
|
||||
@@ -101,16 +107,13 @@ export class GlyphMarginOverlay extends DedupOverlay {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
}
|
||||
if (e.viewInfo) {
|
||||
this._glyphMargin = this._context.configuration.editor.viewInfo.glyphMargin;
|
||||
}
|
||||
if (e.layoutInfo) {
|
||||
this._glyphMarginLeft = this._context.configuration.editor.layoutInfo.glyphMarginLeft;
|
||||
this._glyphMarginWidth = this._context.configuration.editor.layoutInfo.glyphMarginWidth;
|
||||
}
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._glyphMargin = options.get(EditorOption.glyphMargin);
|
||||
this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
|
||||
this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
|
||||
return true;
|
||||
}
|
||||
public onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean {
|
||||
|
||||
@@ -11,6 +11,8 @@ import { RenderingContext } from 'vs/editor/common/view/renderingContext';
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
export class IndentGuidesOverlay extends DynamicViewOverlay {
|
||||
|
||||
@@ -27,12 +29,16 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
|
||||
super();
|
||||
this._context = context;
|
||||
this._primaryLineNumber = 0;
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
this._spaceWidth = this._context.configuration.editor.fontInfo.spaceWidth;
|
||||
this._enabled = this._context.configuration.editor.viewInfo.renderIndentGuides;
|
||||
this._activeIndentEnabled = this._context.configuration.editor.viewInfo.highlightActiveIndentGuide;
|
||||
const wrappingColumn = this._context.configuration.editor.wrappingInfo.wrappingColumn;
|
||||
this._maxIndentLeft = wrappingColumn === -1 ? -1 : (wrappingColumn * this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth);
|
||||
|
||||
const options = this._context.configuration.options;
|
||||
const wrappingInfo = options.get(EditorOption.wrappingInfo);
|
||||
const fontInfo = options.get(EditorOption.fontInfo);
|
||||
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._spaceWidth = fontInfo.spaceWidth;
|
||||
this._enabled = options.get(EditorOption.renderIndentGuides);
|
||||
this._activeIndentEnabled = options.get(EditorOption.highlightActiveIndentGuide);
|
||||
this._maxIndentLeft = wrappingInfo.wrappingColumn === -1 ? -1 : (wrappingInfo.wrappingColumn * fontInfo.typicalHalfwidthCharacterWidth);
|
||||
|
||||
this._renderResult = null;
|
||||
|
||||
@@ -48,20 +54,15 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
}
|
||||
if (e.fontInfo) {
|
||||
this._spaceWidth = this._context.configuration.editor.fontInfo.spaceWidth;
|
||||
}
|
||||
if (e.viewInfo) {
|
||||
this._enabled = this._context.configuration.editor.viewInfo.renderIndentGuides;
|
||||
this._activeIndentEnabled = this._context.configuration.editor.viewInfo.highlightActiveIndentGuide;
|
||||
}
|
||||
if (e.wrappingInfo || e.fontInfo) {
|
||||
const wrappingColumn = this._context.configuration.editor.wrappingInfo.wrappingColumn;
|
||||
this._maxIndentLeft = wrappingColumn === -1 ? -1 : (wrappingColumn * this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth);
|
||||
}
|
||||
const options = this._context.configuration.options;
|
||||
const wrappingInfo = options.get(EditorOption.wrappingInfo);
|
||||
const fontInfo = options.get(EditorOption.fontInfo);
|
||||
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._spaceWidth = fontInfo.spaceWidth;
|
||||
this._enabled = options.get(EditorOption.renderIndentGuides);
|
||||
this._activeIndentEnabled = options.get(EditorOption.highlightActiveIndentGuide);
|
||||
this._maxIndentLeft = wrappingInfo.wrappingColumn === -1 ? -1 : (wrappingInfo.wrappingColumn * fontInfo.typicalHalfwidthCharacterWidth);
|
||||
return true;
|
||||
}
|
||||
public onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import 'vs/css!./lineNumbers';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { DynamicViewOverlay } from 'vs/editor/browser/view/dynamicViewOverlay';
|
||||
import { RenderLineNumbersType } from 'vs/editor/common/config/editorOptions';
|
||||
import { RenderLineNumbersType, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { editorActiveLineNumber, editorLineNumbers } from 'vs/editor/common/view/editorColorRegistry';
|
||||
import { RenderingContext } from 'vs/editor/common/view/renderingContext';
|
||||
@@ -41,13 +41,15 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
|
||||
}
|
||||
|
||||
private _readConfig(): void {
|
||||
const config = this._context.configuration.editor;
|
||||
this._lineHeight = config.lineHeight;
|
||||
this._renderLineNumbers = config.viewInfo.renderLineNumbers;
|
||||
this._renderCustomLineNumbers = config.viewInfo.renderCustomLineNumbers;
|
||||
this._renderFinalNewline = config.viewInfo.renderFinalNewline;
|
||||
this._lineNumbersLeft = config.layoutInfo.lineNumbersLeft;
|
||||
this._lineNumbersWidth = config.layoutInfo.lineNumbersWidth;
|
||||
const options = this._context.configuration.options;
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
const lineNumbers = options.get(EditorOption.lineNumbers);
|
||||
this._renderLineNumbers = lineNumbers.renderType;
|
||||
this._renderCustomLineNumbers = lineNumbers.renderFn;
|
||||
this._renderFinalNewline = options.get(EditorOption.renderFinalNewline);
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._lineNumbersLeft = layoutInfo.lineNumbersLeft;
|
||||
this._lineNumbersWidth = layoutInfo.lineNumbersWidth;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
|
||||
@@ -16,6 +16,7 @@ import { CharacterMapping, ForeignElementType, RenderLineInput, renderViewLine,
|
||||
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
|
||||
import { InlineDecorationType } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { HIGH_CONTRAST, ThemeType } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
const canUseFastRenderedViewLine = (function () {
|
||||
if (platform.isNative) {
|
||||
@@ -80,17 +81,20 @@ export class ViewLineOptions {
|
||||
|
||||
constructor(config: IConfiguration, themeType: ThemeType) {
|
||||
this.themeType = themeType;
|
||||
this.renderWhitespace = config.editor.viewInfo.renderWhitespace;
|
||||
this.renderControlCharacters = config.editor.viewInfo.renderControlCharacters;
|
||||
this.spaceWidth = config.editor.fontInfo.spaceWidth;
|
||||
const options = config.options;
|
||||
const fontInfo = options.get(EditorOption.fontInfo);
|
||||
this.renderWhitespace = options.get(EditorOption.renderWhitespace);
|
||||
this.renderControlCharacters = options.get(EditorOption.renderControlCharacters);
|
||||
this.spaceWidth = fontInfo.spaceWidth;
|
||||
this.useMonospaceOptimizations = (
|
||||
config.editor.fontInfo.isMonospace
|
||||
&& !config.editor.viewInfo.disableMonospaceOptimizations
|
||||
fontInfo.isMonospace
|
||||
&& !options.get(EditorOption.disableMonospaceOptimizations)
|
||||
&& !options.get(EditorOption.fontLigatures)
|
||||
);
|
||||
this.canUseHalfwidthRightwardsArrow = config.editor.fontInfo.canUseHalfwidthRightwardsArrow;
|
||||
this.lineHeight = config.editor.lineHeight;
|
||||
this.stopRenderingLineAfter = config.editor.viewInfo.stopRenderingLineAfter;
|
||||
this.fontLigatures = config.editor.viewInfo.fontLigatures;
|
||||
this.canUseHalfwidthRightwardsArrow = fontInfo.canUseHalfwidthRightwardsArrow;
|
||||
this.lineHeight = options.get(EditorOption.lineHeight);
|
||||
this.stopRenderingLineAfter = options.get(EditorOption.stopRenderingLineAfter);
|
||||
this.fontLigatures = options.get(EditorOption.fontLigatures);
|
||||
}
|
||||
|
||||
public equals(other: ViewLineOptions): boolean {
|
||||
|
||||
@@ -19,6 +19,7 @@ import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
|
||||
import { Viewport } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
class LastRenderedData {
|
||||
|
||||
@@ -73,7 +74,7 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
|
||||
private _isViewportWrapping: boolean;
|
||||
private _revealHorizontalRightPadding: number;
|
||||
private _selections: Selection[];
|
||||
private _scrollOff: number;
|
||||
private _cursorSurroundingLines: number;
|
||||
private _canUseLayerHinting: boolean;
|
||||
private _viewLineOptions: ViewLineOptions;
|
||||
|
||||
@@ -92,19 +93,22 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
|
||||
this.domNode = this._visibleLines.domNode;
|
||||
|
||||
const conf = this._context.configuration;
|
||||
const options = this._context.configuration.options;
|
||||
const fontInfo = options.get(EditorOption.fontInfo);
|
||||
const wrappingInfo = options.get(EditorOption.wrappingInfo);
|
||||
|
||||
this._lineHeight = conf.editor.lineHeight;
|
||||
this._typicalHalfwidthCharacterWidth = conf.editor.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
this._isViewportWrapping = conf.editor.wrappingInfo.isViewportWrapping;
|
||||
this._revealHorizontalRightPadding = conf.editor.viewInfo.revealHorizontalRightPadding;
|
||||
this._scrollOff = conf.editor.viewInfo.cursorSurroundingLines;
|
||||
this._canUseLayerHinting = conf.editor.canUseLayerHinting;
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
|
||||
this._isViewportWrapping = wrappingInfo.isViewportWrapping;
|
||||
this._revealHorizontalRightPadding = options.get(EditorOption.revealHorizontalRightPadding);
|
||||
this._cursorSurroundingLines = options.get(EditorOption.cursorSurroundingLines);
|
||||
this._canUseLayerHinting = !options.get(EditorOption.disableLayerHinting);
|
||||
this._viewLineOptions = new ViewLineOptions(conf, this._context.theme.type);
|
||||
this._selections = [];
|
||||
|
||||
PartFingerprints.write(this.domNode, PartFingerprint.ViewLines);
|
||||
this.domNode.setClassName('view-lines');
|
||||
Configuration.applyFontInfo(this.domNode, conf.editor.fontInfo);
|
||||
Configuration.applyFontInfo(this.domNode, fontInfo);
|
||||
|
||||
// --- width & height
|
||||
this._maxLineWidth = 0;
|
||||
@@ -138,35 +142,25 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
this._visibleLines.onConfigurationChanged(e);
|
||||
if (e.wrappingInfo) {
|
||||
if (e.hasChanged(EditorOption.wrappingInfo)) {
|
||||
this._maxLineWidth = 0;
|
||||
}
|
||||
|
||||
const conf = this._context.configuration;
|
||||
const options = this._context.configuration.options;
|
||||
const fontInfo = options.get(EditorOption.fontInfo);
|
||||
const wrappingInfo = options.get(EditorOption.wrappingInfo);
|
||||
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = conf.editor.lineHeight;
|
||||
}
|
||||
if (e.fontInfo) {
|
||||
this._typicalHalfwidthCharacterWidth = conf.editor.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
}
|
||||
if (e.wrappingInfo) {
|
||||
this._isViewportWrapping = conf.editor.wrappingInfo.isViewportWrapping;
|
||||
}
|
||||
if (e.viewInfo) {
|
||||
this._revealHorizontalRightPadding = conf.editor.viewInfo.revealHorizontalRightPadding;
|
||||
this._scrollOff = conf.editor.viewInfo.cursorSurroundingLines;
|
||||
}
|
||||
if (e.canUseLayerHinting) {
|
||||
this._canUseLayerHinting = conf.editor.canUseLayerHinting;
|
||||
}
|
||||
if (e.fontInfo) {
|
||||
Configuration.applyFontInfo(this.domNode, conf.editor.fontInfo);
|
||||
}
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
|
||||
this._isViewportWrapping = wrappingInfo.isViewportWrapping;
|
||||
this._revealHorizontalRightPadding = options.get(EditorOption.revealHorizontalRightPadding);
|
||||
this._cursorSurroundingLines = options.get(EditorOption.cursorSurroundingLines);
|
||||
this._canUseLayerHinting = !options.get(EditorOption.disableLayerHinting);
|
||||
Configuration.applyFontInfo(this.domNode, fontInfo);
|
||||
|
||||
this._onOptionsMaybeChanged();
|
||||
|
||||
if (e.layoutInfo) {
|
||||
if (e.hasChanged(EditorOption.layoutInfo)) {
|
||||
this._maxLineWidth = 0;
|
||||
}
|
||||
|
||||
@@ -610,7 +604,7 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
|
||||
);
|
||||
|
||||
if (!shouldIgnoreScrollOff) {
|
||||
const context = Math.min((viewportHeight / this._lineHeight) / 2, this._scrollOff);
|
||||
const context = Math.min((viewportHeight / this._lineHeight) / 2, this._cursorSurroundingLines);
|
||||
boxStartY -= context * this._lineHeight;
|
||||
boxEndY += Math.max(0, (context - 1)) * this._lineHeight;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import { DecorationToRender, DedupOverlay } from 'vs/editor/browser/viewParts/gl
|
||||
import { RenderingContext } from 'vs/editor/common/view/renderingContext';
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
export class LinesDecorationsOverlay extends DedupOverlay {
|
||||
|
||||
@@ -20,8 +22,10 @@ export class LinesDecorationsOverlay extends DedupOverlay {
|
||||
constructor(context: ViewContext) {
|
||||
super();
|
||||
this._context = context;
|
||||
this._decorationsLeft = this._context.configuration.editor.layoutInfo.decorationsLeft;
|
||||
this._decorationsWidth = this._context.configuration.editor.layoutInfo.decorationsWidth;
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._decorationsLeft = layoutInfo.decorationsLeft;
|
||||
this._decorationsWidth = layoutInfo.decorationsWidth;
|
||||
this._renderResult = null;
|
||||
this._context.addEventHandler(this);
|
||||
}
|
||||
@@ -35,10 +39,10 @@ export class LinesDecorationsOverlay extends DedupOverlay {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.layoutInfo) {
|
||||
this._decorationsLeft = this._context.configuration.editor.layoutInfo.decorationsLeft;
|
||||
this._decorationsWidth = this._context.configuration.editor.layoutInfo.decorationsWidth;
|
||||
}
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._decorationsLeft = layoutInfo.decorationsLeft;
|
||||
this._decorationsWidth = layoutInfo.decorationsWidth;
|
||||
return true;
|
||||
}
|
||||
public onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean {
|
||||
@@ -107,4 +111,4 @@ export class LinesDecorationsOverlay extends DedupOverlay {
|
||||
}
|
||||
return this._renderResult[lineNumber - startLineNumber];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import { ViewPart } from 'vs/editor/browser/view/viewPart';
|
||||
import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/view/renderingContext';
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
export class Margin extends ViewPart {
|
||||
|
||||
@@ -23,10 +25,13 @@ export class Margin extends ViewPart {
|
||||
|
||||
constructor(context: ViewContext) {
|
||||
super(context);
|
||||
this._canUseLayerHinting = this._context.configuration.editor.canUseLayerHinting;
|
||||
this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
|
||||
this._glyphMarginLeft = this._context.configuration.editor.layoutInfo.glyphMarginLeft;
|
||||
this._glyphMarginWidth = this._context.configuration.editor.layoutInfo.glyphMarginWidth;
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._canUseLayerHinting = !options.get(EditorOption.disableLayerHinting);
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
|
||||
this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
|
||||
|
||||
this._domNode = createFastDomNode(document.createElement('div'));
|
||||
this._domNode.setClassName(Margin.OUTER_CLASS_NAME);
|
||||
@@ -51,15 +56,13 @@ export class Margin extends ViewPart {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.canUseLayerHinting) {
|
||||
this._canUseLayerHinting = this._context.configuration.editor.canUseLayerHinting;
|
||||
}
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
if (e.layoutInfo) {
|
||||
this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
|
||||
this._glyphMarginLeft = this._context.configuration.editor.layoutInfo.glyphMarginLeft;
|
||||
this._glyphMarginWidth = this._context.configuration.editor.layoutInfo.glyphMarginWidth;
|
||||
}
|
||||
this._canUseLayerHinting = !options.get(EditorOption.disableLayerHinting);
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
|
||||
this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import * as platform from 'vs/base/common/platform';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { ILine, RenderedLinesCollection } from 'vs/editor/browser/view/viewLayer';
|
||||
import { PartFingerprint, PartFingerprints, ViewPart } from 'vs/editor/browser/view/viewPart';
|
||||
import { RenderMinimap } from 'vs/editor/common/config/editorOptions';
|
||||
import { RenderMinimap, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { RGBA8 } from 'vs/editor/common/core/rgba';
|
||||
import { IConfiguration, ScrollType } from 'vs/editor/common/editorCommon';
|
||||
@@ -107,17 +107,18 @@ class MinimapOptions {
|
||||
public readonly canvasOuterHeight: number;
|
||||
|
||||
constructor(configuration: IConfiguration) {
|
||||
const pixelRatio = configuration.editor.pixelRatio;
|
||||
const layoutInfo = configuration.editor.layoutInfo;
|
||||
const viewInfo = configuration.editor.viewInfo;
|
||||
const fontInfo = configuration.editor.fontInfo;
|
||||
const options = configuration.options;
|
||||
const pixelRatio = options.get(EditorOption.pixelRatio);
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
const fontInfo = options.get(EditorOption.fontInfo);
|
||||
|
||||
this.renderMinimap = layoutInfo.renderMinimap | 0;
|
||||
this.scrollBeyondLastLine = viewInfo.scrollBeyondLastLine;
|
||||
this.showSlider = viewInfo.minimap.showSlider;
|
||||
this.scrollBeyondLastLine = options.get(EditorOption.scrollBeyondLastLine);
|
||||
const minimapOpts = options.get(EditorOption.minimap);
|
||||
this.showSlider = minimapOpts.showSlider;
|
||||
this.pixelRatio = pixelRatio;
|
||||
this.typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
|
||||
this.lineHeight = configuration.editor.lineHeight;
|
||||
this.lineHeight = options.get(EditorOption.lineHeight);
|
||||
this.minimapLeft = layoutInfo.minimapLeft;
|
||||
this.minimapWidth = layoutInfo.minimapWidth;
|
||||
this.minimapHeight = layoutInfo.height;
|
||||
|
||||
@@ -10,6 +10,8 @@ import { PartFingerprint, PartFingerprints, ViewPart } from 'vs/editor/browser/v
|
||||
import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/view/renderingContext';
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
interface IWidgetData {
|
||||
widget: IOverlayWidget;
|
||||
@@ -35,12 +37,15 @@ export class ViewOverlayWidgets extends ViewPart {
|
||||
constructor(context: ViewContext) {
|
||||
super(context);
|
||||
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._widgets = {};
|
||||
this._verticalScrollbarWidth = this._context.configuration.editor.layoutInfo.verticalScrollbarWidth;
|
||||
this._minimapWidth = this._context.configuration.editor.layoutInfo.minimapWidth;
|
||||
this._horizontalScrollbarHeight = this._context.configuration.editor.layoutInfo.horizontalScrollbarHeight;
|
||||
this._editorHeight = this._context.configuration.editor.layoutInfo.height;
|
||||
this._editorWidth = this._context.configuration.editor.layoutInfo.width;
|
||||
this._verticalScrollbarWidth = layoutInfo.verticalScrollbarWidth;
|
||||
this._minimapWidth = layoutInfo.minimapWidth;
|
||||
this._horizontalScrollbarHeight = layoutInfo.horizontalScrollbarHeight;
|
||||
this._editorHeight = layoutInfo.height;
|
||||
this._editorWidth = layoutInfo.width;
|
||||
|
||||
this._domNode = createFastDomNode(document.createElement('div'));
|
||||
PartFingerprints.write(this._domNode, PartFingerprint.OverlayWidgets);
|
||||
@@ -59,15 +64,15 @@ export class ViewOverlayWidgets extends ViewPart {
|
||||
// ---- begin view event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.layoutInfo) {
|
||||
this._verticalScrollbarWidth = this._context.configuration.editor.layoutInfo.verticalScrollbarWidth;
|
||||
this._minimapWidth = this._context.configuration.editor.layoutInfo.minimapWidth;
|
||||
this._horizontalScrollbarHeight = this._context.configuration.editor.layoutInfo.horizontalScrollbarHeight;
|
||||
this._editorHeight = this._context.configuration.editor.layoutInfo.height;
|
||||
this._editorWidth = this._context.configuration.editor.layoutInfo.width;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._verticalScrollbarWidth = layoutInfo.verticalScrollbarWidth;
|
||||
this._minimapWidth = layoutInfo.minimapWidth;
|
||||
this._horizontalScrollbarHeight = layoutInfo.horizontalScrollbarHeight;
|
||||
this._editorHeight = layoutInfo.height;
|
||||
this._editorWidth = layoutInfo.width;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---- end view event handlers
|
||||
|
||||
@@ -15,6 +15,7 @@ import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/v
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { ITheme } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
class Settings {
|
||||
|
||||
@@ -42,22 +43,24 @@ class Settings {
|
||||
public readonly w: number[];
|
||||
|
||||
constructor(config: IConfiguration, theme: ITheme) {
|
||||
this.lineHeight = config.editor.lineHeight;
|
||||
this.pixelRatio = config.editor.pixelRatio;
|
||||
this.overviewRulerLanes = config.editor.viewInfo.overviewRulerLanes;
|
||||
const options = config.options;
|
||||
this.lineHeight = options.get(EditorOption.lineHeight);
|
||||
this.pixelRatio = options.get(EditorOption.pixelRatio);
|
||||
this.overviewRulerLanes = options.get(EditorOption.overviewRulerLanes);
|
||||
|
||||
this.renderBorder = config.editor.viewInfo.overviewRulerBorder;
|
||||
this.renderBorder = options.get(EditorOption.overviewRulerBorder);
|
||||
const borderColor = theme.getColor(editorOverviewRulerBorder);
|
||||
this.borderColor = borderColor ? borderColor.toString() : null;
|
||||
|
||||
this.hideCursor = config.editor.viewInfo.hideCursorInOverviewRuler;
|
||||
this.hideCursor = options.get(EditorOption.hideCursorInOverviewRuler);
|
||||
const cursorColor = theme.getColor(editorCursorForeground);
|
||||
this.cursorColor = cursorColor ? cursorColor.transparent(0.7).toString() : null;
|
||||
|
||||
this.themeType = theme.type;
|
||||
|
||||
const minimapEnabled = config.editor.viewInfo.minimap.enabled;
|
||||
const minimapSide = config.editor.viewInfo.minimap.side;
|
||||
const minimapOpts = options.get(EditorOption.minimap);
|
||||
const minimapEnabled = minimapOpts.enabled;
|
||||
const minimapSide = minimapOpts.side;
|
||||
const backgroundColor = (minimapEnabled ? TokenizationRegistry.getDefaultBackground() : null);
|
||||
if (backgroundColor === null || minimapSide === 'left') {
|
||||
this.backgroundColor = null;
|
||||
@@ -65,7 +68,8 @@ class Settings {
|
||||
this.backgroundColor = Color.Format.CSS.formatHex(backgroundColor);
|
||||
}
|
||||
|
||||
const position = config.editor.layoutInfo.overviewRuler;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
const position = layoutInfo.overviewRuler;
|
||||
this.top = position.top;
|
||||
this.right = position.right;
|
||||
this.domWidth = position.width;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
|
||||
import { IOverviewRuler } from 'vs/editor/browser/editorBrowser';
|
||||
import { OverviewRulerPosition } from 'vs/editor/common/config/editorOptions';
|
||||
import { OverviewRulerPosition, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { ColorZone, OverviewRulerZone, OverviewZoneManager } from 'vs/editor/common/view/overviewZoneManager';
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
@@ -20,6 +20,7 @@ export class OverviewRuler extends ViewEventHandler implements IOverviewRuler {
|
||||
constructor(context: ViewContext, cssClassName: string) {
|
||||
super();
|
||||
this._context = context;
|
||||
const options = this._context.configuration.options;
|
||||
|
||||
this._domNode = createFastDomNode(document.createElement('canvas'));
|
||||
this._domNode.setClassName(cssClassName);
|
||||
@@ -30,9 +31,9 @@ export class OverviewRuler extends ViewEventHandler implements IOverviewRuler {
|
||||
this._zoneManager.setDOMWidth(0);
|
||||
this._zoneManager.setDOMHeight(0);
|
||||
this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight());
|
||||
this._zoneManager.setLineHeight(this._context.configuration.editor.lineHeight);
|
||||
this._zoneManager.setLineHeight(options.get(EditorOption.lineHeight));
|
||||
|
||||
this._zoneManager.setPixelRatio(this._context.configuration.editor.pixelRatio);
|
||||
this._zoneManager.setPixelRatio(options.get(EditorOption.pixelRatio));
|
||||
|
||||
this._context.addEventHandler(this);
|
||||
}
|
||||
@@ -45,13 +46,15 @@ export class OverviewRuler extends ViewEventHandler implements IOverviewRuler {
|
||||
// ---- begin view event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.lineHeight) {
|
||||
this._zoneManager.setLineHeight(this._context.configuration.editor.lineHeight);
|
||||
const options = this._context.configuration.options;
|
||||
|
||||
if (e.hasChanged(EditorOption.lineHeight)) {
|
||||
this._zoneManager.setLineHeight(options.get(EditorOption.lineHeight));
|
||||
this._render();
|
||||
}
|
||||
|
||||
if (e.pixelRatio) {
|
||||
this._zoneManager.setPixelRatio(this._context.configuration.editor.pixelRatio);
|
||||
if (e.hasChanged(EditorOption.pixelRatio)) {
|
||||
this._zoneManager.setPixelRatio(options.get(EditorOption.pixelRatio));
|
||||
this._domNode.setWidth(this._zoneManager.getDOMWidth());
|
||||
this._domNode.setHeight(this._zoneManager.getDOMHeight());
|
||||
this._domNode.domNode.width = this._zoneManager.getCanvasWidth();
|
||||
|
||||
@@ -11,6 +11,7 @@ import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/v
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
export class Rulers extends ViewPart {
|
||||
|
||||
@@ -26,8 +27,9 @@ export class Rulers extends ViewPart {
|
||||
this.domNode.setAttribute('aria-hidden', 'true');
|
||||
this.domNode.setClassName('view-rulers');
|
||||
this._renderedRulers = [];
|
||||
this._rulers = this._context.configuration.editor.viewInfo.rulers;
|
||||
this._typicalHalfwidthCharacterWidth = this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
const options = this._context.configuration.options;
|
||||
this._rulers = options.get(EditorOption.rulers);
|
||||
this._typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
@@ -37,12 +39,10 @@ export class Rulers extends ViewPart {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.viewInfo || e.layoutInfo || e.fontInfo) {
|
||||
this._rulers = this._context.configuration.editor.viewInfo.rulers;
|
||||
this._typicalHalfwidthCharacterWidth = this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
const options = this._context.configuration.options;
|
||||
this._rulers = options.get(EditorOption.rulers);
|
||||
this._typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;
|
||||
return true;
|
||||
}
|
||||
public onScrollChanged(e: viewEvents.ViewScrollChangedEvent): boolean {
|
||||
return e.scrollHeightChanged;
|
||||
|
||||
@@ -11,6 +11,8 @@ import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { scrollbarShadow } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
export class ScrollDecorationViewPart extends ViewPart {
|
||||
|
||||
@@ -27,7 +29,9 @@ export class ScrollDecorationViewPart extends ViewPart {
|
||||
this._width = 0;
|
||||
this._updateWidth();
|
||||
this._shouldShow = false;
|
||||
this._useShadows = this._context.configuration.editor.viewInfo.scrollbar.useShadows;
|
||||
const options = this._context.configuration.options;
|
||||
const scrollbar = options.get(EditorOption.scrollbar);
|
||||
this._useShadows = scrollbar.useShadows;
|
||||
this._domNode = createFastDomNode(document.createElement('div'));
|
||||
this._domNode.setAttribute('role', 'presentation');
|
||||
this._domNode.setAttribute('aria-hidden', 'true');
|
||||
@@ -50,32 +54,26 @@ export class ScrollDecorationViewPart extends ViewPart {
|
||||
return this._domNode;
|
||||
}
|
||||
|
||||
private _updateWidth(): boolean {
|
||||
const layoutInfo = this._context.configuration.editor.layoutInfo;
|
||||
let newWidth = 0;
|
||||
private _updateWidth(): void {
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
if (layoutInfo.renderMinimap === 0 || (layoutInfo.minimapWidth > 0 && layoutInfo.minimapLeft === 0)) {
|
||||
newWidth = layoutInfo.width;
|
||||
this._width = layoutInfo.width;
|
||||
} else {
|
||||
newWidth = layoutInfo.width - layoutInfo.minimapWidth - layoutInfo.verticalScrollbarWidth;
|
||||
this._width = layoutInfo.width - layoutInfo.minimapWidth - layoutInfo.verticalScrollbarWidth;
|
||||
}
|
||||
if (this._width !== newWidth) {
|
||||
this._width = newWidth;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
let shouldRender = false;
|
||||
if (e.viewInfo) {
|
||||
this._useShadows = this._context.configuration.editor.viewInfo.scrollbar.useShadows;
|
||||
}
|
||||
if (e.layoutInfo) {
|
||||
shouldRender = this._updateWidth();
|
||||
}
|
||||
return this._updateShouldShow() || shouldRender;
|
||||
const options = this._context.configuration.options;
|
||||
const scrollbar = options.get(EditorOption.scrollbar);
|
||||
this._useShadows = scrollbar.useShadows;
|
||||
this._updateWidth();
|
||||
this._updateShouldShow();
|
||||
return true;
|
||||
}
|
||||
public onScrollChanged(e: viewEvents.ViewScrollChangedEvent): boolean {
|
||||
this._scrollTop = e.scrollTop;
|
||||
@@ -99,4 +97,4 @@ registerThemingParticipant((theme, collector) => {
|
||||
if (shadow) {
|
||||
collector.addRule(`.monaco-editor .scroll-decoration { box-shadow: ${shadow} 0 6px 6px -6px inset; }`);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,6 +12,7 @@ import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { editorInactiveSelection, editorSelectionBackground, editorSelectionForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
const enum CornerStyle {
|
||||
EXTERN,
|
||||
@@ -83,9 +84,10 @@ export class SelectionsOverlay extends DynamicViewOverlay {
|
||||
constructor(context: ViewContext) {
|
||||
super();
|
||||
this._context = context;
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
this._roundedSelection = this._context.configuration.editor.viewInfo.roundedSelection;
|
||||
this._typicalHalfwidthCharacterWidth = this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
const options = this._context.configuration.options;
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._roundedSelection = options.get(EditorOption.roundedSelection);
|
||||
this._typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;
|
||||
this._selections = [];
|
||||
this._renderResult = null;
|
||||
this._context.addEventHandler(this);
|
||||
@@ -100,15 +102,10 @@ export class SelectionsOverlay extends DynamicViewOverlay {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
}
|
||||
if (e.viewInfo) {
|
||||
this._roundedSelection = this._context.configuration.editor.viewInfo.roundedSelection;
|
||||
}
|
||||
if (e.fontInfo) {
|
||||
this._typicalHalfwidthCharacterWidth = this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
}
|
||||
const options = this._context.configuration.options;
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._roundedSelection = options.get(EditorOption.roundedSelection);
|
||||
this._typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;
|
||||
return true;
|
||||
}
|
||||
public onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean {
|
||||
@@ -420,4 +417,4 @@ registerThemingParticipant((theme, collector) => {
|
||||
|
||||
function abs(n: number): number {
|
||||
return n < 0 ? -n : n;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as dom from 'vs/base/browser/dom';
|
||||
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { Configuration } from 'vs/editor/browser/config/configuration';
|
||||
import { TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions';
|
||||
import { TextEditorCursorStyle, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/view/renderingContext';
|
||||
@@ -51,11 +51,13 @@ export class ViewCursor {
|
||||
|
||||
constructor(context: ViewContext) {
|
||||
this._context = context;
|
||||
const options = this._context.configuration.options;
|
||||
const fontInfo = options.get(EditorOption.fontInfo);
|
||||
|
||||
this._cursorStyle = this._context.configuration.editor.viewInfo.cursorStyle;
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
this._typicalHalfwidthCharacterWidth = this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
this._lineCursorWidth = Math.min(this._context.configuration.editor.viewInfo.cursorWidth, this._typicalHalfwidthCharacterWidth);
|
||||
this._cursorStyle = options.get(EditorOption.cursorStyle);
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
|
||||
this._lineCursorWidth = Math.min(options.get(EditorOption.cursorWidth), this._typicalHalfwidthCharacterWidth);
|
||||
|
||||
this._isVisible = true;
|
||||
|
||||
@@ -65,7 +67,7 @@ export class ViewCursor {
|
||||
this._domNode.setHeight(this._lineHeight);
|
||||
this._domNode.setTop(0);
|
||||
this._domNode.setLeft(0);
|
||||
Configuration.applyFontInfo(this._domNode, this._context.configuration.editor.fontInfo);
|
||||
Configuration.applyFontInfo(this._domNode, fontInfo);
|
||||
this._domNode.setDisplay('none');
|
||||
|
||||
this._position = new Position(1, 1);
|
||||
@@ -97,17 +99,14 @@ export class ViewCursor {
|
||||
}
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
}
|
||||
if (e.fontInfo) {
|
||||
Configuration.applyFontInfo(this._domNode, this._context.configuration.editor.fontInfo);
|
||||
this._typicalHalfwidthCharacterWidth = this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
}
|
||||
if (e.viewInfo) {
|
||||
this._cursorStyle = this._context.configuration.editor.viewInfo.cursorStyle;
|
||||
this._lineCursorWidth = Math.min(this._context.configuration.editor.viewInfo.cursorWidth, this._typicalHalfwidthCharacterWidth);
|
||||
}
|
||||
const options = this._context.configuration.options;
|
||||
const fontInfo = options.get(EditorOption.fontInfo);
|
||||
|
||||
this._cursorStyle = options.get(EditorOption.cursorStyle);
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
|
||||
this._lineCursorWidth = Math.min(options.get(EditorOption.cursorWidth), this._typicalHalfwidthCharacterWidth);
|
||||
Configuration.applyFontInfo(this._domNode, fontInfo);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
|
||||
import { IntervalTimer, TimeoutTimer } from 'vs/base/common/async';
|
||||
import { ViewPart } from 'vs/editor/browser/view/viewPart';
|
||||
import { IViewCursorRenderData, ViewCursor } from 'vs/editor/browser/viewParts/viewCursors/viewCursor';
|
||||
import { TextEditorCursorBlinkingStyle, TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions';
|
||||
import { TextEditorCursorBlinkingStyle, TextEditorCursorStyle, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { editorCursorBackground, editorCursorForeground } from 'vs/editor/common/view/editorColorRegistry';
|
||||
import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/view/renderingContext';
|
||||
@@ -43,10 +43,11 @@ export class ViewCursors extends ViewPart {
|
||||
constructor(context: ViewContext) {
|
||||
super(context);
|
||||
|
||||
this._readOnly = this._context.configuration.editor.readOnly;
|
||||
this._cursorBlinking = this._context.configuration.editor.viewInfo.cursorBlinking;
|
||||
this._cursorStyle = this._context.configuration.editor.viewInfo.cursorStyle;
|
||||
this._cursorSmoothCaretAnimation = this._context.configuration.editor.viewInfo.cursorSmoothCaretAnimation;
|
||||
const options = this._context.configuration.options;
|
||||
this._readOnly = options.get(EditorOption.readOnly);
|
||||
this._cursorBlinking = options.get(EditorOption.cursorBlinking);
|
||||
this._cursorStyle = options.get(EditorOption.cursorStyle);
|
||||
this._cursorSmoothCaretAnimation = options.get(EditorOption.cursorSmoothCaretAnimation);
|
||||
this._selectionIsEmpty = true;
|
||||
|
||||
this._isVisible = false;
|
||||
@@ -84,21 +85,17 @@ export class ViewCursors extends ViewPart {
|
||||
// --- begin event handlers
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
const options = this._context.configuration.options;
|
||||
|
||||
if (e.readOnly) {
|
||||
this._readOnly = this._context.configuration.editor.readOnly;
|
||||
}
|
||||
if (e.viewInfo) {
|
||||
this._cursorBlinking = this._context.configuration.editor.viewInfo.cursorBlinking;
|
||||
this._cursorStyle = this._context.configuration.editor.viewInfo.cursorStyle;
|
||||
this._cursorSmoothCaretAnimation = this._context.configuration.editor.viewInfo.cursorSmoothCaretAnimation;
|
||||
}
|
||||
this._readOnly = options.get(EditorOption.readOnly);
|
||||
this._cursorBlinking = options.get(EditorOption.cursorBlinking);
|
||||
this._cursorStyle = options.get(EditorOption.cursorStyle);
|
||||
this._cursorSmoothCaretAnimation = options.get(EditorOption.cursorSmoothCaretAnimation);
|
||||
|
||||
this._updateBlinking();
|
||||
this._updateDomClassName();
|
||||
|
||||
this._primaryCursor.onConfigurationChanged(e);
|
||||
this._updateBlinking();
|
||||
if (e.viewInfo) {
|
||||
this._updateDomClassName();
|
||||
}
|
||||
for (let i = 0, len = this._secondaryCursors.length; i < len; i++) {
|
||||
this._secondaryCursors[i].onConfigurationChanged(e);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/v
|
||||
import { ViewContext } from 'vs/editor/common/view/viewContext';
|
||||
import * as viewEvents from 'vs/editor/common/view/viewEvents';
|
||||
import { IViewWhitespaceViewportData } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
export interface IMyViewZone {
|
||||
whitespaceId: string;
|
||||
@@ -40,9 +42,12 @@ export class ViewZones extends ViewPart {
|
||||
|
||||
constructor(context: ViewContext) {
|
||||
super(context);
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
this._contentWidth = this._context.configuration.editor.layoutInfo.contentWidth;
|
||||
this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
|
||||
this.domNode = createFastDomNode(document.createElement('div'));
|
||||
this.domNode.setClassName('view-zones');
|
||||
@@ -84,15 +89,15 @@ export class ViewZones extends ViewPart {
|
||||
}
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
const options = this._context.configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
if (e.lineHeight) {
|
||||
this._lineHeight = this._context.configuration.editor.lineHeight;
|
||||
return this._recomputeWhitespacesProps();
|
||||
}
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
|
||||
if (e.layoutInfo) {
|
||||
this._contentWidth = this._context.configuration.editor.layoutInfo.contentWidth;
|
||||
this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
|
||||
if (e.hasChanged(EditorOption.lineHeight)) {
|
||||
this._recomputeWhitespacesProps();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -23,7 +23,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService
|
||||
import { ICommandDelegate } from 'vs/editor/browser/view/viewController';
|
||||
import { IContentWidgetData, IOverlayWidgetData, View } from 'vs/editor/browser/view/viewImpl';
|
||||
import { ViewOutgoingEvents } from 'vs/editor/browser/view/viewOutgoingEvents';
|
||||
import * as editorOptions from 'vs/editor/common/config/editorOptions';
|
||||
import { ConfigurationChangedEvent, EditorLayoutInfo, IEditorOptions, EditorOption, IComputedEditorOptions, FindComputedEditorOptionValueById } from 'vs/editor/common/config/editorOptions';
|
||||
import { Cursor, CursorStateChangedEvent } from 'vs/editor/common/controller/cursor';
|
||||
import { CursorColumns, ICursors } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { ICursorPositionChangedEvent, ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
|
||||
@@ -125,8 +125,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
private readonly _onDidChangeModelDecorations: Emitter<IModelDecorationsChangedEvent> = this._register(new Emitter<IModelDecorationsChangedEvent>());
|
||||
public readonly onDidChangeModelDecorations: Event<IModelDecorationsChangedEvent> = this._onDidChangeModelDecorations.event;
|
||||
|
||||
private readonly _onDidChangeConfiguration: Emitter<editorOptions.IConfigurationChangedEvent> = this._register(new Emitter<editorOptions.IConfigurationChangedEvent>());
|
||||
public readonly onDidChangeConfiguration: Event<editorOptions.IConfigurationChangedEvent> = this._onDidChangeConfiguration.event;
|
||||
private readonly _onDidChangeConfiguration: Emitter<ConfigurationChangedEvent> = this._register(new Emitter<ConfigurationChangedEvent>());
|
||||
public readonly onDidChangeConfiguration: Event<ConfigurationChangedEvent> = this._onDidChangeConfiguration.event;
|
||||
|
||||
protected readonly _onDidChangeModel: Emitter<editorCommon.IModelChangedEvent> = this._register(new Emitter<editorCommon.IModelChangedEvent>());
|
||||
public readonly onDidChangeModel: Event<editorCommon.IModelChangedEvent> = this._onDidChangeModel.event;
|
||||
@@ -140,8 +140,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
private readonly _onDidAttemptReadOnlyEdit: Emitter<void> = this._register(new Emitter<void>());
|
||||
public readonly onDidAttemptReadOnlyEdit: Event<void> = this._onDidAttemptReadOnlyEdit.event;
|
||||
|
||||
private readonly _onDidLayoutChange: Emitter<editorOptions.EditorLayoutInfo> = this._register(new Emitter<editorOptions.EditorLayoutInfo>());
|
||||
public readonly onDidLayoutChange: Event<editorOptions.EditorLayoutInfo> = this._onDidLayoutChange.event;
|
||||
private readonly _onDidLayoutChange: Emitter<EditorLayoutInfo> = this._register(new Emitter<EditorLayoutInfo>());
|
||||
public readonly onDidLayoutChange: Event<EditorLayoutInfo> = this._onDidLayoutChange.event;
|
||||
|
||||
private readonly _editorTextFocus: BooleanEventEmitter = this._register(new BooleanEventEmitter());
|
||||
public readonly onDidFocusEditorText: Event<void> = this._editorTextFocus.onDidChangeToTrue;
|
||||
@@ -236,7 +236,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
|
||||
constructor(
|
||||
domElement: HTMLElement,
|
||||
options: editorOptions.IEditorOptions,
|
||||
options: IEditorOptions,
|
||||
codeEditorWidgetOptions: ICodeEditorWidgetOptions,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@ICodeEditorService codeEditorService: ICodeEditorService,
|
||||
@@ -259,10 +259,12 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
this._register(this._configuration.onDidChange((e) => {
|
||||
this._onDidChangeConfiguration.fire(e);
|
||||
|
||||
if (e.layoutInfo) {
|
||||
this._onDidLayoutChange.fire(this._configuration.editor.layoutInfo);
|
||||
const options = this._configuration.options;
|
||||
if (e.hasChanged(EditorOption.layoutInfo)) {
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._onDidLayoutChange.fire(layoutInfo);
|
||||
}
|
||||
if (this._configuration.editor.showUnused) {
|
||||
if (options.get(EditorOption.showUnused)) {
|
||||
this._domElement.classList.add(SHOW_UNUSED_ENABLED_CLASS);
|
||||
} else {
|
||||
this._domElement.classList.remove(SHOW_UNUSED_ENABLED_CLASS);
|
||||
@@ -327,7 +329,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
this._codeEditorService.addCodeEditor(this);
|
||||
}
|
||||
|
||||
protected _createConfiguration(options: editorOptions.IEditorOptions, accessibilityService: IAccessibilityService): editorCommon.IConfiguration {
|
||||
protected _createConfiguration(options: IEditorOptions, accessibilityService: IAccessibilityService): editorCommon.IConfiguration {
|
||||
return new Configuration(this.isSimpleWidget, options, this._domElement, accessibilityService);
|
||||
}
|
||||
|
||||
@@ -362,15 +364,19 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
return this._instantiationService.invokeFunction(fn);
|
||||
}
|
||||
|
||||
public updateOptions(newOptions: editorOptions.IEditorOptions): void {
|
||||
public updateOptions(newOptions: IEditorOptions): void {
|
||||
this._configuration.updateOptions(newOptions);
|
||||
}
|
||||
|
||||
public getConfiguration(): editorOptions.InternalEditorOptions {
|
||||
return this._configuration.editor;
|
||||
public getOptions(): IComputedEditorOptions {
|
||||
return this._configuration.options;
|
||||
}
|
||||
|
||||
public getRawConfiguration(): editorOptions.IEditorOptions {
|
||||
public getOption<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T> {
|
||||
return this._configuration.options.get(id);
|
||||
}
|
||||
|
||||
public getRawOptions(): IEditorOptions {
|
||||
return this._configuration.getRawOptions();
|
||||
}
|
||||
|
||||
@@ -972,7 +978,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
if (!this._modelData) {
|
||||
return false;
|
||||
}
|
||||
if (this._configuration.editor.readOnly) {
|
||||
if (this._configuration.options.get(EditorOption.readOnly)) {
|
||||
// read only editor => sorry!
|
||||
return false;
|
||||
}
|
||||
@@ -984,7 +990,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
if (!this._modelData) {
|
||||
return false;
|
||||
}
|
||||
if (this._configuration.editor.readOnly) {
|
||||
if (this._configuration.options.get(EditorOption.readOnly)) {
|
||||
// read only editor => sorry!
|
||||
return false;
|
||||
}
|
||||
@@ -1028,7 +1034,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
if (!this._modelData) {
|
||||
return null;
|
||||
}
|
||||
return this._modelData.model.getLineDecorations(lineNumber, this._id, this._configuration.editor.readOnly);
|
||||
return this._modelData.model.getLineDecorations(lineNumber, this._id, this._configuration.options.get(EditorOption.readOnly));
|
||||
}
|
||||
|
||||
public deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[] {
|
||||
@@ -1119,8 +1125,10 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
}
|
||||
}
|
||||
|
||||
public getLayoutInfo(): editorOptions.EditorLayoutInfo {
|
||||
return this._configuration.editor.layoutInfo;
|
||||
public getLayoutInfo(): EditorLayoutInfo {
|
||||
const options = this._configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
return layoutInfo;
|
||||
}
|
||||
|
||||
public createOverviewRuler(cssClassName: string): editorBrowser.IOverviewRuler | null {
|
||||
@@ -1268,7 +1276,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
}
|
||||
|
||||
const position = this._modelData.model.validatePosition(rawPosition);
|
||||
const layoutInfo = this._configuration.editor.layoutInfo;
|
||||
const options = this._configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
const top = CodeEditorWidget._getVerticalOffsetForPosition(this._modelData, position.lineNumber, position.column) - this.getScrollTop();
|
||||
const left = this._modelData.view.getOffsetForColumn(position.lineNumber, position.column) + layoutInfo.glyphMarginWidth + layoutInfo.lineNumbersWidth + layoutInfo.decorationsWidth - this.getScrollLeft();
|
||||
@@ -1276,7 +1285,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
return {
|
||||
top: top,
|
||||
left: left,
|
||||
height: this._configuration.editor.lineHeight
|
||||
height: options.get(EditorOption.lineHeight)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1295,7 +1304,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
}
|
||||
|
||||
public applyFontInfo(target: HTMLElement): void {
|
||||
Configuration.applyFontInfoSlow(target, this._configuration.editor.fontInfo);
|
||||
Configuration.applyFontInfoSlow(target, this._configuration.options.get(EditorOption.fontInfo));
|
||||
}
|
||||
|
||||
protected _attachModel(model: ITextModel | null): void {
|
||||
@@ -1601,10 +1610,10 @@ class EditorContextKeysManager extends Disposable {
|
||||
}
|
||||
|
||||
private _updateFromConfig(): void {
|
||||
const config = this._editor.getConfiguration();
|
||||
const options = this._editor.getOptions();
|
||||
|
||||
this._editorTabMovesFocus.set(config.tabFocusMode);
|
||||
this._editorReadonly.set(config.readOnly);
|
||||
this._editorTabMovesFocus.set(options.get(EditorOption.tabFocusMode));
|
||||
this._editorReadonly.set(options.get(EditorOption.readOnly));
|
||||
}
|
||||
|
||||
private _updateFromSelection(): void {
|
||||
|
||||
@@ -20,7 +20,7 @@ import * as editorBrowser from 'vs/editor/browser/editorBrowser';
|
||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
|
||||
import { DiffReview } from 'vs/editor/browser/widget/diffReview';
|
||||
import * as editorOptions from 'vs/editor/common/config/editorOptions';
|
||||
import { IDiffEditorOptions, IEditorOptions, EditorLayoutInfo, IComputedEditorOptions, EditorOption, EditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { IPosition, Position } from 'vs/editor/common/core/position';
|
||||
import { IRange, Range } from 'vs/editor/common/core/range';
|
||||
import { ISelection, Selection } from 'vs/editor/common/core/selection';
|
||||
@@ -213,7 +213,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
|
||||
constructor(
|
||||
domElement: HTMLElement,
|
||||
options: editorOptions.IDiffEditorOptions,
|
||||
options: IDiffEditorOptions,
|
||||
clipboardService: IClipboardService | null,
|
||||
@IEditorWorkerService editorWorkerService: IEditorWorkerService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@@ -422,7 +422,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
this._layoutOverviewRulers();
|
||||
}
|
||||
|
||||
private _createLeftHandSideEditor(options: editorOptions.IDiffEditorOptions, instantiationService: IInstantiationService): CodeEditorWidget {
|
||||
private _createLeftHandSideEditor(options: IDiffEditorOptions, instantiationService: IInstantiationService): CodeEditorWidget {
|
||||
const editor = this._createInnerEditor(instantiationService, this._originalDomNode, this._adjustOptionsForLeftHandSide(options, this._originalIsEditable));
|
||||
|
||||
this._register(editor.onDidScrollChange((e) => {
|
||||
@@ -455,7 +455,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
return editor;
|
||||
}
|
||||
|
||||
private _createRightHandSideEditor(options: editorOptions.IDiffEditorOptions, instantiationService: IInstantiationService): CodeEditorWidget {
|
||||
private _createRightHandSideEditor(options: IDiffEditorOptions, instantiationService: IInstantiationService): CodeEditorWidget {
|
||||
const editor = this._createInnerEditor(instantiationService, this._modifiedDomNode, this._adjustOptionsForRightHandSide(options));
|
||||
|
||||
this._register(editor.onDidScrollChange((e) => {
|
||||
@@ -480,7 +480,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
}));
|
||||
|
||||
this._register(editor.onDidChangeConfiguration((e) => {
|
||||
if (e.fontInfo && editor.getModel()) {
|
||||
if (e.hasChanged(EditorOption.fontInfo) && editor.getModel()) {
|
||||
this._onViewZonesChanged();
|
||||
}
|
||||
}));
|
||||
@@ -494,7 +494,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
return editor;
|
||||
}
|
||||
|
||||
protected _createInnerEditor(instantiationService: IInstantiationService, container: HTMLElement, options: editorOptions.IEditorOptions): CodeEditorWidget {
|
||||
protected _createInnerEditor(instantiationService: IInstantiationService, container: HTMLElement, options: IEditorOptions): CodeEditorWidget {
|
||||
return instantiationService.createInstance(CodeEditorWidget, container, options, {});
|
||||
}
|
||||
|
||||
@@ -568,7 +568,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
return this.modifiedEditor;
|
||||
}
|
||||
|
||||
public updateOptions(newOptions: editorOptions.IDiffEditorOptions): void {
|
||||
public updateOptions(newOptions: IDiffEditorOptions): void {
|
||||
|
||||
// Handle side by side
|
||||
let renderSideBySideChanged = false;
|
||||
@@ -967,8 +967,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
}
|
||||
}
|
||||
|
||||
private _adjustOptionsForSubEditor(options: editorOptions.IDiffEditorOptions): editorOptions.IDiffEditorOptions {
|
||||
let clonedOptions: editorOptions.IDiffEditorOptions = objects.deepClone(options || {});
|
||||
private _adjustOptionsForSubEditor(options: IDiffEditorOptions): IDiffEditorOptions {
|
||||
let clonedOptions: IDiffEditorOptions = objects.deepClone(options || {});
|
||||
clonedOptions.inDiffEditor = true;
|
||||
clonedOptions.wordWrap = 'off';
|
||||
clonedOptions.wordWrapMinified = false;
|
||||
@@ -986,7 +986,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
return clonedOptions;
|
||||
}
|
||||
|
||||
private _adjustOptionsForLeftHandSide(options: editorOptions.IDiffEditorOptions, isEditable: boolean): editorOptions.IEditorOptions {
|
||||
private _adjustOptionsForLeftHandSide(options: IDiffEditorOptions, isEditable: boolean): IEditorOptions {
|
||||
let result = this._adjustOptionsForSubEditor(options);
|
||||
result.readOnly = !isEditable;
|
||||
result.overviewRulerLanes = 1;
|
||||
@@ -994,9 +994,9 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
return result;
|
||||
}
|
||||
|
||||
private _adjustOptionsForRightHandSide(options: editorOptions.IDiffEditorOptions): editorOptions.IEditorOptions {
|
||||
private _adjustOptionsForRightHandSide(options: IDiffEditorOptions): IEditorOptions {
|
||||
let result = this._adjustOptionsForSubEditor(options);
|
||||
result.revealHorizontalRightPadding = editorOptions.EDITOR_DEFAULTS.viewInfo.revealHorizontalRightPadding + DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH;
|
||||
result.revealHorizontalRightPadding = EditorOptions.revealHorizontalRightPadding.defaultValue + DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH;
|
||||
result.scrollbar!.verticalHasArrows = false;
|
||||
result.extraEditorClassName = 'modified-in-monaco-diff-editor';
|
||||
return result;
|
||||
@@ -1830,7 +1830,7 @@ class DiffEditorWidgetInline extends DiffEditorWidgetStyle implements IDiffEdito
|
||||
|
||||
this.decorationsLeft = dataSource.getOriginalEditor().getLayoutInfo().decorationsLeft;
|
||||
|
||||
this._register(dataSource.getOriginalEditor().onDidLayoutChange((layoutInfo: editorOptions.EditorLayoutInfo) => {
|
||||
this._register(dataSource.getOriginalEditor().onDidLayoutChange((layoutInfo: EditorLayoutInfo) => {
|
||||
if (this.decorationsLeft !== layoutInfo.decorationsLeft) {
|
||||
this.decorationsLeft = layoutInfo.decorationsLeft;
|
||||
dataSource.relayoutEditors();
|
||||
@@ -1946,14 +1946,14 @@ class DiffEditorWidgetInline extends DiffEditorWidgetStyle implements IDiffEdito
|
||||
class InlineViewZonesComputer extends ViewZonesComputer {
|
||||
|
||||
private readonly originalModel: ITextModel;
|
||||
private readonly modifiedEditorConfiguration: editorOptions.InternalEditorOptions;
|
||||
private readonly modifiedEditorOptions: IComputedEditorOptions;
|
||||
private readonly modifiedEditorTabSize: number;
|
||||
private readonly renderIndicators: boolean;
|
||||
|
||||
constructor(lineChanges: editorCommon.ILineChange[], originalForeignVZ: IEditorWhitespace[], modifiedForeignVZ: IEditorWhitespace[], originalEditor: editorBrowser.ICodeEditor, modifiedEditor: editorBrowser.ICodeEditor, renderIndicators: boolean) {
|
||||
super(lineChanges, originalForeignVZ, modifiedForeignVZ);
|
||||
this.originalModel = originalEditor.getModel()!;
|
||||
this.modifiedEditorConfiguration = modifiedEditor.getConfiguration();
|
||||
this.modifiedEditorOptions = modifiedEditor.getOptions();
|
||||
this.modifiedEditorTabSize = modifiedEditor.getModel()!.getOptions().tabSize;
|
||||
this.renderIndicators = renderIndicators;
|
||||
}
|
||||
@@ -1993,13 +1993,16 @@ class InlineViewZonesComputer extends ViewZonesComputer {
|
||||
|
||||
let sb = createStringBuilder(10000);
|
||||
let marginHTML: string[] = [];
|
||||
let lineDecorationsWidth = this.modifiedEditorConfiguration.layoutInfo.decorationsWidth;
|
||||
let lineHeight = this.modifiedEditorConfiguration.lineHeight;
|
||||
const typicalHalfwidthCharacterWidth = this.modifiedEditorConfiguration.fontInfo.typicalHalfwidthCharacterWidth;
|
||||
const layoutInfo = this.modifiedEditorOptions.get(EditorOption.layoutInfo);
|
||||
const fontInfo = this.modifiedEditorOptions.get(EditorOption.fontInfo);
|
||||
const lineDecorationsWidth = layoutInfo.decorationsWidth;
|
||||
|
||||
let lineHeight = this.modifiedEditorOptions.get(EditorOption.lineHeight);
|
||||
const typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
|
||||
let maxCharsPerLine = 0;
|
||||
const originalContent: string[] = [];
|
||||
for (let lineNumber = lineChange.originalStartLineNumber; lineNumber <= lineChange.originalEndLineNumber; lineNumber++) {
|
||||
maxCharsPerLine = Math.max(maxCharsPerLine, this._renderOriginalLine(lineNumber - lineChange.originalStartLineNumber, this.originalModel, this.modifiedEditorConfiguration, this.modifiedEditorTabSize, lineNumber, decorations, sb));
|
||||
maxCharsPerLine = Math.max(maxCharsPerLine, this._renderOriginalLine(lineNumber - lineChange.originalStartLineNumber, this.originalModel, this.modifiedEditorOptions, this.modifiedEditorTabSize, lineNumber, decorations, sb));
|
||||
originalContent.push(this.originalModel.getLineContent(lineNumber));
|
||||
|
||||
if (this.renderIndicators) {
|
||||
@@ -2009,17 +2012,17 @@ class InlineViewZonesComputer extends ViewZonesComputer {
|
||||
]);
|
||||
}
|
||||
}
|
||||
maxCharsPerLine += this.modifiedEditorConfiguration.viewInfo.scrollBeyondLastColumn;
|
||||
maxCharsPerLine += this.modifiedEditorOptions.get(EditorOption.scrollBeyondLastColumn);
|
||||
|
||||
let domNode = document.createElement('div');
|
||||
domNode.className = 'view-lines line-delete';
|
||||
domNode.innerHTML = sb.build();
|
||||
Configuration.applyFontInfoSlow(domNode, this.modifiedEditorConfiguration.fontInfo);
|
||||
Configuration.applyFontInfoSlow(domNode, fontInfo);
|
||||
|
||||
let marginDomNode = document.createElement('div');
|
||||
marginDomNode.className = 'inline-deleted-margin-view-zone';
|
||||
marginDomNode.innerHTML = marginHTML.join('');
|
||||
Configuration.applyFontInfoSlow(marginDomNode, this.modifiedEditorConfiguration.fontInfo);
|
||||
Configuration.applyFontInfoSlow(marginDomNode, fontInfo);
|
||||
|
||||
return {
|
||||
shouldNotShrink: true,
|
||||
@@ -2038,9 +2041,10 @@ class InlineViewZonesComputer extends ViewZonesComputer {
|
||||
};
|
||||
}
|
||||
|
||||
private _renderOriginalLine(count: number, originalModel: ITextModel, config: editorOptions.InternalEditorOptions, tabSize: number, lineNumber: number, decorations: InlineDecoration[], sb: IStringBuilder): number {
|
||||
private _renderOriginalLine(count: number, originalModel: ITextModel, options: IComputedEditorOptions, tabSize: number, lineNumber: number, decorations: InlineDecoration[], sb: IStringBuilder): number {
|
||||
const lineTokens = originalModel.getLineTokens(lineNumber);
|
||||
const lineContent = lineTokens.getLineContent();
|
||||
const fontInfo = options.get(EditorOption.fontInfo);
|
||||
|
||||
const actualDecorations = LineDecoration.filter(decorations, lineNumber, 1, lineContent.length + 1);
|
||||
|
||||
@@ -2050,14 +2054,14 @@ class InlineViewZonesComputer extends ViewZonesComputer {
|
||||
sb.appendASCIIString(' char-delete');
|
||||
}
|
||||
sb.appendASCIIString('" style="top:');
|
||||
sb.appendASCIIString(String(count * config.lineHeight));
|
||||
sb.appendASCIIString(String(count * options.get(EditorOption.lineHeight)));
|
||||
sb.appendASCIIString('px;width:1000000px;">');
|
||||
|
||||
const isBasicASCII = ViewLineRenderingData.isBasicASCII(lineContent, originalModel.mightContainNonBasicASCII());
|
||||
const containsRTL = ViewLineRenderingData.containsRTL(lineContent, isBasicASCII, originalModel.mightContainRTL());
|
||||
const output = renderViewLine(new RenderLineInput(
|
||||
(config.fontInfo.isMonospace && !config.viewInfo.disableMonospaceOptimizations),
|
||||
config.fontInfo.canUseHalfwidthRightwardsArrow,
|
||||
(fontInfo.isMonospace && !options.get(EditorOption.disableMonospaceOptimizations) && !options.get(EditorOption.fontLigatures)),
|
||||
fontInfo.canUseHalfwidthRightwardsArrow,
|
||||
lineContent,
|
||||
false,
|
||||
isBasicASCII,
|
||||
@@ -2066,11 +2070,11 @@ class InlineViewZonesComputer extends ViewZonesComputer {
|
||||
lineTokens,
|
||||
actualDecorations,
|
||||
tabSize,
|
||||
config.fontInfo.spaceWidth,
|
||||
config.viewInfo.stopRenderingLineAfter,
|
||||
config.viewInfo.renderWhitespace,
|
||||
config.viewInfo.renderControlCharacters,
|
||||
config.viewInfo.fontLigatures,
|
||||
fontInfo.spaceWidth,
|
||||
options.get(EditorOption.stopRenderingLineAfter),
|
||||
options.get(EditorOption.renderWhitespace),
|
||||
options.get(EditorOption.renderControlCharacters),
|
||||
options.get(EditorOption.fontLigatures),
|
||||
null // Send no selections, original line cannot be selected
|
||||
), sb);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user