Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)

* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463

* fix config changes

* fix strictnull checks
This commit is contained in:
Anthony Dresser
2019-09-15 22:38:26 -07:00
committed by GitHub
parent fa6c52699e
commit ea0f9e6ce9
1226 changed files with 21541 additions and 17633 deletions

View File

@@ -10,8 +10,10 @@ import * as vscode from 'vscode';
import { TelemetryReporter, TelemetryViews } from './telemetry';
import { doubleEscapeSingleQuotes, backEscapeDoubleQuotes, getTelemetryErrorType } from './utils';
import { ChildProcess, exec } from 'child_process';
import { promisify } from 'util';
import { readFile } from 'fs';
const localize = nls.loadMessageBundle();
const ssmsMinVer = JSON.parse(JSON.stringify(require('./config.json'))).version;
let exePath: string;
const runningProcesses: Map<number, ChildProcess> = new Map<number, ChildProcess>();
@@ -66,6 +68,8 @@ export interface LaunchSsmsDialogParams {
export async function activate(context: vscode.ExtensionContext): Promise<void> {
// This is for Windows-specific support so do nothing on other platforms
if (process.platform === 'win32') {
const rawConfig = await promisify(readFile)(path.join(context.extensionPath, 'config.json'));
const ssmsMinVer = JSON.parse(rawConfig.toString()).version;
exePath = path.join(context.extensionPath, 'ssmsmin', 'Windows', ssmsMinVer, 'ssmsmin.exe');
registerCommands(context);
}
@@ -259,4 +263,4 @@ export async function buildUrn(node: azdata.objectexplorer.ObjectExplorerNode):
}
return ['Server'].concat(urnNodes).join('/');
}
}

View File

@@ -84,7 +84,7 @@
"mocha-junit-reporter": "^1.17.0",
"mocha-multi-reporters": "^1.1.7",
"@types/mocha": "^5.2.5",
"@types/node": "^8.10.25",
"@types/node": "^10.14.8",
"mocha": "^5.2.0",
"should": "^13.2.1",
"typemoq": "^2.1.0",

View File

@@ -259,9 +259,9 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
title: this.CommandLabelString,
actions: [this.openButton, this.parseButton]
}], {
horizontal: false,
componentWidth: 420
}).component();
horizontal: false,
componentWidth: 420
}).component();
this.typeDropdown.onValueChanged((type) => {
switch (type.selected) {
case (JobStepDialog.TSQLScript):
@@ -375,8 +375,8 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
component: this.userInputBox,
title: this.RunAsUserLabel
}], {
componentWidth: 400
}).component();
componentWidth: 400
}).component();
let formWrapper = view.modelBuilder.loadingComponent().withItem(formModel).component();
formWrapper.loading = false;
@@ -419,9 +419,9 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
component: this.retryAttemptsBox,
title: this.RetryAttemptsLabel
}], {
horizontal: false,
componentWidth: '100%'
})
horizontal: false,
componentWidth: '100%'
})
.component();
let retryIntervalContainer = view.modelBuilder.formContainer()
@@ -430,8 +430,8 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
component: this.retryIntervalBox,
title: this.RetryIntervalLabel
}], {
horizontal: false
})
horizontal: false
})
.component();
let retryFlexContainer = view.modelBuilder.flexContainer()
@@ -574,4 +574,4 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
return validationResult.valid;
});
}
}
}

View File

@@ -7,10 +7,10 @@
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.6.tgz#b8622d50557dd155e9f2f634b7d68fd38de5e94b"
integrity sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==
"@types/node@^8.10.25":
version "8.10.45"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.45.tgz#4c49ba34106bc7dced77ff6bae8eb6543cde8351"
integrity sha512-tGVTbA+i3qfXsLbq9rEq/hezaHY55QxQLeXQL2ejNgFAxxrgu8eMmYIOsRcl7hN1uTLVsKOOYacV/rcJM3sfgQ==
"@types/node@^10.14.8":
version "10.14.17"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.17.tgz#b96d4dd3e427382482848948041d3754d40fd5ce"
integrity sha512-p/sGgiPaathCfOtqu2fx5Mu1bcjuP8ALFg4xpGgNkcin7LwRyzUKniEHBKdcE1RPsenq5JVPIpMTJSygLboygQ==
ajv@^6.5.5:
version "6.10.0"

View File

@@ -627,7 +627,7 @@
},
"devDependencies": {
"@types/mocha": "^5.2.5",
"@types/node": "^8.0.24",
"@types/node": "^10.14.8",
"mocha": "^5.2.0",
"should": "^13.2.1",
"vscode": "^1.1.26",

View File

@@ -7,10 +7,10 @@
resolved "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz#8a4accfc403c124a0bafe8a9fc61a05ec1032073"
integrity sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==
"@types/node@^8.0.24":
version "8.10.36"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.36.tgz#eac05d576fbcd0b4ea3c912dc58c20475c08d9e4"
integrity sha512-SL6KhfM7PTqiFmbCW3eVNwVBZ+88Mrzbuvn9olPsfv43mbiWaFY+nRcz/TGGku0/lc2FepdMbImdMY1JrQ+zbw==
"@types/node@^10.14.8":
version "10.14.17"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.17.tgz#b96d4dd3e427382482848948041d3754d40fd5ce"
integrity sha512-p/sGgiPaathCfOtqu2fx5Mu1bcjuP8ALFg4xpGgNkcin7LwRyzUKniEHBKdcE1RPsenq5JVPIpMTJSygLboygQ==
ajv@^5.3.0:
version "5.5.2"

View File

@@ -49,9 +49,9 @@ export class DeployConfigPage extends DacFxConfigPage {
radioButtons,
this.databaseDropdownComponent
], {
horizontal: true,
componentWidth: 400
});
horizontal: true,
componentWidth: 400
});
this.form = this.formBuilder.component();
await this.view.initializeModel(this.form);

View File

@@ -69,8 +69,8 @@ export class DeployPlanPage extends DacFxConfigPage {
},
this.dataLossComponentGroup
], {
horizontal: true,
});
horizontal: true,
});
this.form = this.formBuilder.component();
await this.view.initializeModel(this.form);

View File

@@ -39,9 +39,9 @@ export class ExportConfigPage extends DacFxConfigPage {
databaseComponent,
fileBrowserComponent,
], {
horizontal: true,
componentWidth: 400
}).component();
horizontal: true,
componentWidth: 400
}).component();
await this.view.initializeModel(this.form);
return true;
}

View File

@@ -42,9 +42,9 @@ export class ExtractConfigPage extends DacFxConfigPage {
versionComponent,
fileBrowserComponent,
], {
horizontal: true,
componentWidth: 400
}).component();
horizontal: true,
componentWidth: 400
}).component();
await this.view.initializeModel(this.form);
return true;
}

View File

@@ -41,9 +41,9 @@ export class ImportConfigPage extends DacFxConfigPage {
serverComponent,
databaseComponent,
], {
horizontal: true,
componentWidth: 400
}).component();
horizontal: true,
componentWidth: 400
}).component();
await this.view.initializeModel(this.form);
return true;
}

View File

@@ -51,8 +51,8 @@ export class SelectOperationPage extends BasePage {
importComponent,
exportComponent
], {
horizontal: true
}).component();
horizontal: true
}).component();
await this.view.initializeModel(this.form);
this.instance.setDoneButton(Operation.deploy);

View File

@@ -73,7 +73,7 @@
"config.autofetch": "When enabled, commits will automatically be fetched from the default remote of the current Git repository.",
"config.autofetchPeriod": "Duration in seconds between each automatic git fetch, when `git.autofetch` is enabled.",
"config.confirmSync": "Confirm before synchronizing git repositories.",
"config.countBadge": "Controls the git badge counter.",
"config.countBadge": "Controls the Git count badge.",
"config.countBadge.all": "Count all changes.",
"config.countBadge.tracked": "Count only tracked changes.",
"config.countBadge.off": "Turn off counter.",

View File

@@ -1260,7 +1260,7 @@ export class CommandCenter {
if (documents.length > 0) {
const message = documents.length === 1
? localize('unsaved files single', "The following file is unsaved and will not be included in the commit if you proceed: {0}.\n\nWould you like to save it before committing?", path.basename(documents[0].uri.fsPath))
? localize('unsaved files single', "The following file has unsaved changes which won't be included in the commit if you proceed: {0}.\n\nWould you like to save it before committing?", path.basename(documents[0].uri.fsPath))
: localize('unsaved files', "There are {0} unsaved files.\n\nWould you like to save them before committing?", documents.length);
const saveAndCommit = localize('save and commit', "Save All & Commit");
const commit = localize('commit', "Commit Anyway");

View File

@@ -3,13 +3,13 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { window, workspace, Uri, Disposable, Event, EventEmitter, DecorationData, DecorationProvider, ThemeColor } from 'vscode';
import { window, workspace, Uri, Disposable, Event, EventEmitter, Decoration, DecorationProvider, ThemeColor } from 'vscode';
import * as path from 'path';
import { Repository, GitResourceGroup } from './repository';
import { Model } from './model';
import { debounce } from './decorators';
import { filterEvent, dispose, anyEvent, fireEvent } from './util';
import { GitErrorCodes, Status } from './api/git';
import { GitErrorCodes } from './api/git';
type Callback = { resolve: (status: boolean) => void, reject: (err: any) => void };
@@ -29,7 +29,7 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
this.disposables.push(window.registerDecorationProvider(this));
}
provideDecoration(uri: Uri): Promise<DecorationData | undefined> {
provideDecoration(uri: Uri): Promise<Decoration | undefined> {
const repository = this.model.getRepository(uri);
if (!repository) {
@@ -48,7 +48,7 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
this.checkIgnoreSoon();
}).then(ignored => {
if (ignored) {
return <DecorationData>{
return <Decoration>{
priority: 3,
color: new ThemeColor('gitDecoration.ignoredResourceForeground')
};
@@ -89,7 +89,7 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
class GitDecorationProvider implements DecorationProvider {
private static SubmoduleDecorationData: DecorationData = {
private static SubmoduleDecorationData: Decoration = {
title: 'Submodule',
letter: 'S',
color: new ThemeColor('gitDecoration.submoduleResourceForeground')
@@ -99,7 +99,7 @@ class GitDecorationProvider implements DecorationProvider {
readonly onDidChangeDecorations: Event<Uri[]> = this._onDidChangeDecorations.event;
private disposables: Disposable[] = [];
private decorations = new Map<string, DecorationData>();
private decorations = new Map<string, Decoration>();
constructor(private repository: Repository) {
this.disposables.push(
@@ -109,7 +109,7 @@ class GitDecorationProvider implements DecorationProvider {
}
private onDidRunGitStatus(): void {
let newDecorations = new Map<string, DecorationData>();
let newDecorations = new Map<string, Decoration>();
this.collectSubmoduleDecorationData(newDecorations);
this.collectDecorationData(this.repository.indexGroup, newDecorations);
@@ -121,25 +121,22 @@ class GitDecorationProvider implements DecorationProvider {
this._onDidChangeDecorations.fire([...uris.values()].map(value => Uri.parse(value, true)));
}
private collectDecorationData(group: GitResourceGroup, bucket: Map<string, DecorationData>): void {
private collectDecorationData(group: GitResourceGroup, bucket: Map<string, Decoration>): void {
group.resourceStates.forEach(r => {
if (r.resourceDecoration
&& r.type !== Status.DELETED
&& r.type !== Status.INDEX_DELETED
) {
if (r.resourceDecoration) {
// not deleted and has a decoration
bucket.set(r.original.toString(), r.resourceDecoration);
}
});
}
private collectSubmoduleDecorationData(bucket: Map<string, DecorationData>): void {
private collectSubmoduleDecorationData(bucket: Map<string, Decoration>): void {
for (const submodule of this.repository.submodules) {
bucket.set(Uri.file(path.join(this.repository.root, submodule.path)).toString(), GitDecorationProvider.SubmoduleDecorationData);
}
}
provideDecoration(uri: Uri): DecorationData | undefined {
provideDecoration(uri: Uri): Decoration | undefined {
return this.decorations.get(uri.toString());
}

View File

@@ -1628,7 +1628,7 @@ export class Repository {
const args = ['for-each-ref', '--format', '%(refname) %(objectname)'];
if (opts && opts.sort && opts.sort !== 'alphabetically') {
args.push('--sort', opts.sort);
args.push('--sort', `-${opts.sort}`);
}
const result = await this.run(args);
@@ -1766,7 +1766,7 @@ export class Repository {
}
const raw = await readfile(templatePath, 'utf8');
return raw.replace(/\n?#.*/g, '');
return raw.replace(/^\s*#.*$\n?/gm, '');
} catch (err) {
return '';

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { commands, Uri, Command, EventEmitter, Event, scm, SourceControl, SourceControlInputBox, SourceControlResourceGroup, SourceControlResourceState, SourceControlResourceDecorations, SourceControlInputBoxValidation, Disposable, ProgressLocation, window, workspace, WorkspaceEdit, ThemeColor, DecorationData, Memento, SourceControlInputBoxValidationType, OutputChannel, LogLevel, env, ProgressOptions, CancellationToken } from 'vscode';
import { commands, Uri, Command, EventEmitter, Event, scm, SourceControl, SourceControlInputBox, SourceControlResourceGroup, SourceControlResourceState, SourceControlResourceDecorations, SourceControlInputBoxValidation, Disposable, ProgressLocation, window, workspace, WorkspaceEdit, ThemeColor, Decoration, Memento, SourceControlInputBoxValidationType, OutputChannel, LogLevel, env, ProgressOptions, CancellationToken } from 'vscode';
import { Repository as BaseRepository, Commit, Stash, GitError, Submodule, CommitOptions, ForcePushMode } from './git';
import { anyEvent, filterEvent, eventToPromise, dispose, find, isDescendant, IDisposable, onceEvent, EmptyDisposable, debounceEvent, combinedDisposable } from './util';
import { memoize, throttle, debounce } from './decorators';
@@ -157,10 +157,7 @@ export class Resource implements SourceControlResourceState {
const tooltip = this.tooltip;
const strikeThrough = this.strikeThrough;
const faded = this.faded;
const letter = this.letter;
const color = this.color;
return { strikeThrough, faded, tooltip, light, dark, letter, color, source: 'git.resource' /*todo@joh*/ };
return { strikeThrough, faded, tooltip, light, dark };
}
get letter(): string {
@@ -247,12 +244,12 @@ export class Resource implements SourceControlResourceState {
}
}
get resourceDecoration(): DecorationData {
get resourceDecoration(): Decoration {
const title = this.tooltip;
const letter = this.letter;
const color = this.color;
const priority = this.priority;
return { bubble: true, source: 'git.resource', title, letter, color, priority };
return { bubble: true, title, letter, color, priority };
}
constructor(

View File

@@ -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();
}

View File

@@ -0,0 +1,10 @@
test/**
src/**
tsconfig.json
out/test/**
out/**
extension.webpack.config.js
cgmanifest.json
yarn.lock
preview-src/**
webpack.config.js

View File

@@ -0,0 +1,3 @@
# Image Preview
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.

View File

@@ -0,0 +1,20 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
resolve: {
mainFields: ['module', 'main']
},
entry: {
extension: './src/extension.ts',
}
});

View File

@@ -0,0 +1,78 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
html, body {
height: 100%;
max-height: 100%;
}
body img {
max-width: none;
max-height: none;
}
.container:focus {
outline: none !important;
}
.container {
padding: 5px 0 0 10px;
box-sizing: border-box;
user-select: none;
}
.container.image {
padding: 0;
display: flex;
box-sizing: border-box;
}
.container.image img {
padding: 0;
background-position: 0 0, 8px 8px;
background-size: 16px 16px;
}
.container.image img {
background-image:
linear-gradient(45deg, rgb(230, 230, 230) 25%, transparent 25%, transparent 75%, rgb(230, 230, 230) 75%, rgb(230, 230, 230)),
linear-gradient(45deg, rgb(230, 230, 230) 25%, transparent 25%, transparent 75%, rgb(230, 230, 230) 75%, rgb(230, 230, 230));
}
.vscode-dark.container.image img {
background-image:
linear-gradient(45deg, rgb(20, 20, 20) 25%, transparent 25%, transparent 75%, rgb(20, 20, 20) 75%, rgb(20, 20, 20)),
linear-gradient(45deg, rgb(20, 20, 20) 25%, transparent 25%, transparent 75%, rgb(20, 20, 20) 75%, rgb(20, 20, 20));
}
.container img.pixelated {
image-rendering: pixelated;
}
.container img.scale-to-fit {
max-width: calc(100% - 20px);
max-height: calc(100% - 20px);
object-fit: contain;
}
.container img {
margin: auto;
}
.container.zoom-in {
cursor: zoom-in;
}
.container.zoom-out {
cursor: zoom-out;
}
.container .embedded-link,
.container .embedded-link:hover {
cursor: pointer;
text-decoration: underline;
margin-left: 5px;
}

View File

@@ -0,0 +1,258 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// @ts-check
"use strict";
(function () {
/**
* @param {number} value
* @param {number} min
* @param {number} max
* @return {number}
*/
function clamp(value, min, max) {
return Math.min(Math.max(value, min), max);
}
function getSettings() {
const element = document.getElementById('image-preview-settings');
if (element) {
const data = element.getAttribute('data-settings');
if (data) {
return JSON.parse(data);
}
}
throw new Error(`Could not load settings`);
}
/**
* Enable image-rendering: pixelated for images scaled by more than this.
*/
const PIXELATION_THRESHOLD = 3;
const SCALE_PINCH_FACTOR = 0.075;
const MAX_SCALE = 20;
const MIN_SCALE = 0.1;
const zoomLevels = [
0.1,
0.2,
0.3,
0.4,
0.5,
0.6,
0.7,
0.8,
0.9,
1,
1.5,
2,
3,
5,
7,
10,
15,
20
];
const isMac = getSettings().isMac;
const vscode = acquireVsCodeApi();
const initialState = vscode.getState() || { scale: 'fit', offsetX: 0, offsetY: 0 };
// State
let scale = initialState.scale;
let ctrlPressed = false;
let altPressed = false;
// Elements
const container = /** @type {HTMLElement} */(document.querySelector('body'));
const image = document.querySelector('img');
function updateScale(newScale) {
if (!image || !image.parentElement) {
return;
}
if (newScale === 'fit') {
scale = 'fit';
image.classList.add('scale-to-fit');
image.classList.remove('pixelated');
image.style.minWidth = 'auto';
image.style.width = 'auto';
vscode.setState(undefined);
} else {
const oldWidth = image.width;
const oldHeight = image.height;
scale = clamp(newScale, MIN_SCALE, MAX_SCALE);
if (scale >= PIXELATION_THRESHOLD) {
image.classList.add('pixelated');
} else {
image.classList.remove('pixelated');
}
const { scrollTop, scrollLeft } = image.parentElement;
const dx = (scrollLeft + image.parentElement.clientWidth / 2) / image.parentElement.scrollWidth;
const dy = (scrollTop + image.parentElement.clientHeight / 2) / image.parentElement.scrollHeight;
image.classList.remove('scale-to-fit');
image.style.minWidth = `${(image.naturalWidth * scale)}px`;
image.style.width = `${(image.naturalWidth * scale)}px`;
const newWidth = image.width;
const scaleFactor = (newWidth - oldWidth) / oldWidth;
const newScrollLeft = ((oldWidth * scaleFactor * dx) + scrollLeft);
const newScrollTop = ((oldHeight * scaleFactor * dy) + scrollTop);
// scrollbar.setScrollPosition({
// scrollLeft: newScrollLeft,
// scrollTop: newScrollTop,
// });
vscode.setState({ scale: scale, offsetX: newScrollLeft, offsetY: newScrollTop });
}
vscode.postMessage({
type: 'zoom',
value: scale
});
}
function firstZoom() {
if (!image) {
return;
}
scale = image.clientWidth / image.naturalWidth;
updateScale(scale);
}
window.addEventListener('keydown', (/** @type {KeyboardEvent} */ e) => {
if (!image) {
return;
}
ctrlPressed = e.ctrlKey;
altPressed = e.altKey;
if (isMac ? altPressed : ctrlPressed) {
container.classList.remove('zoom-in');
container.classList.add('zoom-out');
}
});
window.addEventListener('keyup', (/** @type {KeyboardEvent} */ e) => {
if (!image) {
return;
}
ctrlPressed = e.ctrlKey;
altPressed = e.altKey;
if (!(isMac ? altPressed : ctrlPressed)) {
container.classList.remove('zoom-out');
container.classList.add('zoom-in');
}
});
container.addEventListener('click', (/** @type {MouseEvent} */ e) => {
if (!image) {
return;
}
if (e.button !== 0) {
return;
}
// left click
if (scale === 'fit') {
firstZoom();
}
if (!(isMac ? altPressed : ctrlPressed)) { // zoom in
let i = 0;
for (; i < zoomLevels.length; ++i) {
if (zoomLevels[i] > scale) {
break;
}
}
updateScale(zoomLevels[i] || MAX_SCALE);
} else {
let i = zoomLevels.length - 1;
for (; i >= 0; --i) {
if (zoomLevels[i] < scale) {
break;
}
}
updateScale(zoomLevels[i] || MIN_SCALE);
}
});
container.addEventListener('wheel', (/** @type {WheelEvent} */ e) => {
if (!image) {
return;
}
const isScrollWheelKeyPressed = isMac ? altPressed : ctrlPressed;
if (!isScrollWheelKeyPressed && !e.ctrlKey) { // pinching is reported as scroll wheel + ctrl
return;
}
e.preventDefault();
e.stopPropagation();
if (scale === 'fit') {
firstZoom();
}
let delta = e.deltaY > 0 ? 1 : -1;
updateScale(scale * (1 - delta * SCALE_PINCH_FACTOR));
});
window.addEventListener('scroll', () => {
if (!image || !image.parentElement || scale === 'fit') {
return;
}
const entry = vscode.getState();
if (entry) {
vscode.setState({ scale: entry.scale, offsetX: window.scrollX, offsetY: window.scrollY });
}
});
container.classList.add('image');
container.classList.add('zoom-in');
image.classList.add('scale-to-fit');
image.style.visibility = 'hidden';
image.addEventListener('load', () => {
if (!image) {
return;
}
vscode.postMessage({
type: 'size',
value: `${image.naturalWidth}x${image.naturalHeight}`,
});
image.style.visibility = 'visible';
updateScale(scale);
if (initialState.scale !== 'fit') {
window.scrollTo(initialState.offsetX, initialState.offsetY);
}
});
window.addEventListener('message', e => {
switch (e.data.type) {
case 'setScale':
updateScale(e.data.scale);
break;
}
});
}());

View File

@@ -0,0 +1,43 @@
{
"name": "image-preview",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"publisher": "vscode",
"enableProposedApi": true,
"license": "MIT",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
"engines": {
"vscode": "^1.39.0"
},
"main": "./out/extension",
"categories": [
"Other"
],
"activationEvents": [
"onWebviewEditor:imagePreview.previewEditor"
],
"contributes": {
"webviewEditors": [
{
"viewType": "imagePreview.previewEditor",
"displayName": "%webviewEditors.displayName%",
"selector": [
{
"filenamePattern": "*.{jpg,jpe,jpeg,png,bmp,gif,ico,tga,tif,tiff,webp}"
}
]
}
]
},
"scripts": {
"compile": "gulp compile-extension:image-preview",
"watch": "npm run build-preview && gulp watch-extension:image-preview",
"vscode:prepublish": "npm run build-ext",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:image-preview ./tsconfig.json"
},
"dependencies": {
"vscode-extension-telemetry": "0.1.1",
"vscode-nls": "^4.0.0"
}
}

View File

@@ -0,0 +1,5 @@
{
"displayName": "Image Preview",
"description": "Previews images.",
"webviewEditors.displayName": "Image Preview"
}

View File

@@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
export function disposeAll(disposables: vscode.Disposable[]) {
while (disposables.length) {
const item = disposables.pop();
if (item) {
item.dispose();
}
}
}
export abstract class Disposable {
private _isDisposed = false;
protected _disposables: vscode.Disposable[] = [];
public dispose(): any {
if (this._isDisposed) {
return;
}
this._isDisposed = true;
disposeAll(this._disposables);
}
protected _register<T extends vscode.Disposable>(value: T): T {
if (this._isDisposed) {
value.dispose();
} else {
this._disposables.push(value);
}
return value;
}
protected get isDisposed() {
return this._isDisposed;
}
}

View File

@@ -0,0 +1,28 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { Preview } from './preview';
import { SizeStatusBarEntry } from './sizeStatusBarEntry';
import { ZoomStatusBarEntry } from './zoomStatusBarEntry';
export function activate(context: vscode.ExtensionContext) {
const extensionRoot = vscode.Uri.file(context.extensionPath);
const sizeStatusBarEntry = new SizeStatusBarEntry();
context.subscriptions.push(sizeStatusBarEntry);
const zoomStatusBarEntry = new ZoomStatusBarEntry();
context.subscriptions.push(zoomStatusBarEntry);
context.subscriptions.push(vscode.window.registerWebviewEditorProvider(
Preview.viewType,
{
async resolveWebviewEditor(resource: vscode.Uri, editor: vscode.WebviewEditor): Promise<void> {
// tslint:disable-next-line: no-unused-expression
new Preview(extensionRoot, resource, editor, sizeStatusBarEntry, zoomStatusBarEntry);
}
}));
}

View File

@@ -0,0 +1,113 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { SizeStatusBarEntry } from './sizeStatusBarEntry';
import { ZoomStatusBarEntry } from './zoomStatusBarEntry';
import { Disposable } from './dispose';
export class Preview extends Disposable {
public static readonly viewType = 'imagePreview.previewEditor';
private _active = true;
constructor(
private readonly extensionRoot: vscode.Uri,
resource: vscode.Uri,
private readonly webviewEditor: vscode.WebviewEditor,
private readonly sizeStatusBarEntry: SizeStatusBarEntry,
private readonly zoomStatusBarEntry: ZoomStatusBarEntry,
) {
super();
const resourceRoot = resource.with({
path: resource.path.replace(/\/[^\/]+?\.\w+$/, '/'),
});
webviewEditor.webview.options = {
enableScripts: true,
localResourceRoots: [
resourceRoot,
extensionRoot,
]
};
webviewEditor.webview.html = this.getWebiewContents(webviewEditor, resource);
this._register(webviewEditor.webview.onDidReceiveMessage(message => {
switch (message.type) {
case 'size':
{
this.sizeStatusBarEntry.update(message.value);
break;
}
case 'zoom':
{
this.zoomStatusBarEntry.update(message.value);
break;
}
}
}));
this._register(zoomStatusBarEntry.onDidChangeScale(e => {
this.webviewEditor.webview.postMessage({ type: 'setScale', scale: e.scale });
}));
this._register(webviewEditor.onDidChangeViewState(() => {
this.update();
}));
this._register(webviewEditor.onDidDispose(() => {
if (this._active) {
this.sizeStatusBarEntry.hide();
this.zoomStatusBarEntry.hide();
}
}));
this.update();
}
private update() {
this._active = this.webviewEditor.active;
if (this._active) {
this.sizeStatusBarEntry.show();
this.zoomStatusBarEntry.show();
} else {
this.sizeStatusBarEntry.hide();
this.zoomStatusBarEntry.hide();
}
}
private getWebiewContents(webviewEditor: vscode.WebviewEditor, resource: vscode.Uri): string {
const settings = {
isMac: process.platform === 'darwin'
};
return /* html */`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Image Preview</title>
<link rel="stylesheet" class="code-user-style" href="${escapeAttribute(this.extensionResource('/media/main.css'))}" type="text/css" media="screen">
<meta id="image-preview-settings" data-settings="${escapeAttribute(JSON.stringify(settings))}">
</head>
<body class="container image scale-to-fit">
<img src="${escapeAttribute(webviewEditor.webview.asWebviewUri(resource))}">
<script src="${escapeAttribute(this.extensionResource('/media/main.js'))}"></script>
</body>
</html>`;
}
private extensionResource(path: string) {
return this.webviewEditor.webview.asWebviewUri(this.extensionRoot.with({
path: this.extensionRoot.path + path
}));
}
}
function escapeAttribute(value: string | vscode.Uri): string {
return value.toString().replace(/"/g, '&quot;');
}

View File

@@ -0,0 +1,33 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { Disposable } from './dispose';
export class SizeStatusBarEntry extends Disposable {
private readonly _entry: vscode.StatusBarItem;
constructor() {
super();
this._entry = this._register(vscode.window.createStatusBarItem({
id: 'imagePreview.size',
name: 'Image Size',
alignment: vscode.StatusBarAlignment.Right,
priority: 101 /* to the left of editor status (100) */,
}));
}
public show() {
this._entry.show();
}
public hide() {
this._entry.hide();
}
public update(text: string) {
this._entry.text = text;
}
}

View File

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

View File

@@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { Disposable } from './dispose';
const localize = nls.loadMessageBundle();
const selectZoomLevelCommandId = '_imagePreview.selectZoomLevel';
type Scale = number | 'fit';
export class ZoomStatusBarEntry extends Disposable {
private readonly _entry: vscode.StatusBarItem;
private readonly _onDidChangeScale = this._register(new vscode.EventEmitter<{ scale: Scale }>());
public readonly onDidChangeScale = this._onDidChangeScale.event;
constructor() {
super();
this._entry = this._register(vscode.window.createStatusBarItem({
id: 'imagePreview.zoom',
name: 'Image Zoom',
alignment: vscode.StatusBarAlignment.Right,
priority: 102 /* to the left of editor size entry (101) */,
}));
this._register(vscode.commands.registerCommand(selectZoomLevelCommandId, async () => {
type MyPickItem = vscode.QuickPickItem & { scale: Scale };
const scales: Scale[] = [10, 5, 2, 1, 0.5, 0.2, 'fit'];
const options = scales.map((scale): MyPickItem => ({
label: this.zoomLabel(scale),
scale
}));
const pick = await vscode.window.showQuickPick(options, {
placeHolder: localize('zoomStatusBar.placeholder', "Select zoom level")
});
if (pick) {
this._onDidChangeScale.fire({ scale: pick.scale });
}
}));
this._entry.command = selectZoomLevelCommandId;
}
public show() {
this._entry.show();
}
public hide() {
this._entry.hide();
}
public update(scale: Scale) {
this._entry.text = this.zoomLabel(scale);
}
private zoomLabel(scale: Scale): string {
return scale === 'fit'
? localize('zoomStatusBar.wholeImageLabel', "Whole Image")
: `${Math.round(scale * 100)}%`;
}
}

View File

@@ -0,0 +1,10 @@
{
"extends": "../shared.tsconfig.json",
"compilerOptions": {
"outDir": "./out",
"experimentalDecorators": true
},
"include": [
"src/**/*"
]
}

View File

@@ -0,0 +1,46 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
applicationinsights@1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/applicationinsights/-/applicationinsights-1.0.8.tgz#db6e3d983cf9f9405fe1ee5ba30ac6e1914537b5"
integrity sha512-KzOOGdphOS/lXWMFZe5440LUdFbrLpMvh2SaRxn7BmiI550KAoSb2gIhiq6kJZ9Ir3AxRRztjhzif+e5P5IXIg==
dependencies:
diagnostic-channel "0.2.0"
diagnostic-channel-publishers "0.2.1"
zone.js "0.7.6"
diagnostic-channel-publishers@0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/diagnostic-channel-publishers/-/diagnostic-channel-publishers-0.2.1.tgz#8e2d607a8b6d79fe880b548bc58cc6beb288c4f3"
integrity sha1-ji1geottef6IC1SLxYzGvrKIxPM=
diagnostic-channel@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/diagnostic-channel/-/diagnostic-channel-0.2.0.tgz#cc99af9612c23fb1fff13612c72f2cbfaa8d5a17"
integrity sha1-zJmvlhLCP7H/8TYSxy8sv6qNWhc=
dependencies:
semver "^5.3.0"
semver@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==
vscode-extension-telemetry@0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.1.1.tgz#91387e06b33400c57abd48979b0e790415ae110b"
integrity sha512-TkKKG/B/J94DP5qf6xWB4YaqlhWDg6zbbqVx7Bz//stLQNnfE9XS1xm3f6fl24c5+bnEK0/wHgMgZYKIKxPeUA==
dependencies:
applicationinsights "1.0.8"
vscode-nls@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==
zone.js@0.7.6:
version "0.7.6"
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.7.6.tgz#fbbc39d3e0261d0986f1ba06306eb3aeb0d22009"
integrity sha1-+7w50+AmHQmG8boGMG6zrrDSIAk=

View File

@@ -18,8 +18,8 @@ import { Telemetry, LanguageClientErrorHandler } from './telemetry';
import * as Constants from '../constants';
import { TelemetryFeature, FlatFileImportFeature } from './features';
import * as serviceUtils from './serviceUtils';
const baseConfig = require('./config.json');
import { promisify } from 'util';
import { readFile } from 'fs';
export class ServiceClient {
private statusView: vscode.StatusBarItem;
@@ -28,8 +28,9 @@ export class ServiceClient {
this.statusView = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
}
public startService(context: vscode.ExtensionContext): Promise<SqlOpsDataClient> {
let config: IConfig = JSON.parse(JSON.stringify(baseConfig));
public async startService(context: vscode.ExtensionContext): Promise<SqlOpsDataClient> {
const rawConfig = await promisify(readFile)(path.join(context.extensionPath, 'config.json'));
const config = JSON.parse(rawConfig.toString());
config.installDirectory = path.join(context.extensionPath, config.installDirectory);
config.proxy = vscode.workspace.getConfiguration('http').get('proxy');
config.strictSSL = vscode.workspace.getConfiguration('http').get('proxyStrictSSL') || true;
@@ -163,4 +164,3 @@ class CustomOutputChannel implements vscode.OutputChannel {
dispose(): void {
}
}

View File

@@ -6,8 +6,6 @@
import * as path from 'path';
import * as os from 'os';
const baseConfig = require('./config.json');
// The function is a duplicate of \src\paths.js. IT would be better to import path.js but it doesn't
// work for now because the extension is running in different process.
export function getAppDataPath(): string {
@@ -55,25 +53,6 @@ export function verifyPlatform(): Thenable<boolean> {
}
}
export function getServiceInstallConfig(basePath?: string): any {
if (!basePath) {
basePath = __dirname;
}
let config = JSON.parse(JSON.stringify(baseConfig));
config.installDirectory = path.join(basePath, config.installDirectory);
return config;
}
export function getResolvedServiceInstallationPath(runtime: Runtime, basePath?: string): string {
let config = getServiceInstallConfig(basePath);
let dir = config.installDirectory;
dir = dir.replace('{#version#}', config.version);
dir = dir.replace('{#platform#}', getRuntimeDisplayName(runtime));
return dir;
}
export function getRuntimeDisplayName(runtime: Runtime): string {
switch (runtime) {
case Runtime.Windows_64:

View File

@@ -95,9 +95,9 @@ export class ModifyColumnsPage extends ImportPage {
title: ''
}
], {
horizontal: false,
componentWidth: '100%'
}).component();
horizontal: false,
componentWidth: '100%'
}).component();
this.loading.component = this.form;
await this.view.initializeModel(this.form);

View File

@@ -50,7 +50,7 @@
},
"devDependencies": {
"@types/chai": "3.4.34",
"@types/node": "7.0.43",
"@types/node": "^10.14.8",
"adstest": "github:ranasaria/adstest.git#0.0.2",
"chai": "3.5.0",
"mocha-junit-reporter": "^1.17.0",

View File

@@ -7,10 +7,10 @@
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.4.34.tgz#d5335792823bb09cddd5e38c3d211b709183854d"
integrity sha1-1TNXkoI7sJzd1eOMPSEbcJGDhU0=
"@types/node@7.0.43":
version "7.0.43"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.43.tgz#a187e08495a075f200ca946079c914e1a5fe962c"
integrity sha512-7scYwwfHNppXvH/9JzakbVxk0o0QUILVk1Lv64GRaxwPuGpnF1QBiwdvhDpLcymb8BpomQL3KYoWKq3wUdDMhQ==
"@types/node@^10.14.8":
version "10.14.17"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.17.tgz#b96d4dd3e427382482848948041d3754d40fd5ce"
integrity sha512-p/sGgiPaathCfOtqu2fx5Mu1bcjuP8ALFg4xpGgNkcin7LwRyzUKniEHBKdcE1RPsenq5JVPIpMTJSygLboygQ==
"@types/node@^8.0.47":
version "8.10.45"

View File

@@ -14,7 +14,7 @@
"dependencies": {
"jsonc-parser": "^2.1.1",
"request-light": "^0.2.4",
"vscode-json-languageservice": "^3.3.1",
"vscode-json-languageservice": "^3.3.3",
"vscode-languageserver": "^5.3.0-next.8",
"vscode-nls": "^4.1.1",
"vscode-uri": "^2.0.3"

View File

@@ -312,7 +312,7 @@ function validateTextDocument(textDocument: TextDocument, callback?: (diagnostic
const jsonDocument = getJSONDocument(textDocument);
const version = textDocument.version;
const documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'ignore' } : { comments: 'error', trailingCommas: 'error' };
const documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'warning' } : { comments: 'error', trailingCommas: 'error' };
languageService.doValidation(textDocument, jsonDocument, documentSettings).then(diagnostics => {
setTimeout(() => {
const currDocument = documents.get(textDocument.uri);

View File

@@ -54,11 +54,6 @@ https-proxy-agent@^2.2.1:
agent-base "^4.1.0"
debug "^3.1.0"
jsonc-parser@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.1.0.tgz#eb0d0c7a3c33048524ce3574c57c7278fb2f1bf3"
integrity sha512-n9GrT8rrr2fhvBbANa1g+xFmgGK5X91KFeDwlKQ3+SJfmH5+tKv/M/kahx/TXOMflfWHKGKqKyfHQaLKTNzJ6w==
jsonc-parser@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.1.1.tgz#83dc3d7a6e7186346b889b1280eefa04446c6d3e"
@@ -78,12 +73,12 @@ request-light@^0.2.4:
https-proxy-agent "^2.2.1"
vscode-nls "^4.0.0"
vscode-json-languageservice@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.3.1.tgz#4ad2c82db849a7bbe54fcbf5c9b3a2ed26dc8fee"
integrity sha512-Qyvlrftexu1acvwbMt+CDehVrDZtFV1GAJrKdOCHQL9bWNhzI06KEiSd4iXR0NUOuAdroG/uU4wBkH6e5CcTXg==
vscode-json-languageservice@^3.3.3:
version "3.3.3"
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.3.3.tgz#f7e512a2cd5e82fecbebf507d6fceaea47661297"
integrity sha512-5vL3OXTUuQpn6+tGd47dopio+7WwbtIZ07zfYMzAUX8eVWPZjfEsLeSWmQk5Xw+vwgu+j5zC4koz5UofLDGGRA==
dependencies:
jsonc-parser "^2.1.0"
jsonc-parser "^2.1.1"
vscode-languageserver-types "^3.15.0-next.2"
vscode-nls "^4.1.1"
vscode-uri "^2.0.3"

View File

@@ -50,8 +50,7 @@
".babelrc",
".jsonc",
".eslintrc",
".eslintrc.json",
"tslint.json"
".eslintrc.json"
],
"configuration": "./language-configuration.json"
}

View File

@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/eb3898715b50d7911377a650e383a768a3a21f25",
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/00b05ebe6850083664d92d0eba6e5ee8f153baa6",
"name": "Markdown",
"scopeName": "text.html.markdown",
"patterns": [
@@ -70,11 +70,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -103,11 +103,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -136,11 +136,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -169,11 +169,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -202,11 +202,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -235,11 +235,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -268,11 +268,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -294,18 +294,18 @@
]
},
"fenced_code_block_r": {
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(R|r|s|S|Rprofile)(\\s+[^`~]*)?$)",
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(R|r|s|S|Rprofile|\\{\\.r.+?\\})(\\s+[^`~]*)?$)",
"name": "markup.fenced_code.block.markdown",
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
"beginCaptures": {
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -334,11 +334,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -367,11 +367,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -403,11 +403,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -436,11 +436,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -469,11 +469,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -502,11 +502,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -535,11 +535,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -568,11 +568,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -601,11 +601,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -634,11 +634,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -667,11 +667,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -700,11 +700,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -716,7 +716,7 @@
{
"begin": "(^|\\G)(\\s*)(.*)",
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
"contentName": "meta.embedded.block.cpp",
"contentName": "meta.embedded.block.cpp source.cpp",
"patterns": [
{
"include": "source.cpp"
@@ -733,11 +733,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -766,11 +766,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -799,11 +799,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -832,11 +832,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -865,11 +865,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -898,11 +898,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -931,11 +931,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -957,18 +957,18 @@
]
},
"fenced_code_block_js": {
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(js|jsx|javascript|es6|mjs)(\\s+[^`~]*)?$)",
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(js|jsx|javascript|es6|mjs|\\{\\.js.+?\\})(\\s+[^`~]*)?$)",
"name": "markup.fenced_code.block.markdown",
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
"beginCaptures": {
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -997,11 +997,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1030,11 +1030,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1063,11 +1063,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1096,11 +1096,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1129,11 +1129,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1162,11 +1162,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1195,11 +1195,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1228,11 +1228,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1261,11 +1261,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1287,18 +1287,18 @@
]
},
"fenced_code_block_python": {
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi)(\\s+[^`~]*)?$)",
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi|\\{\\.python.+?\\})(\\s+[^`~]*)?$)",
"name": "markup.fenced_code.block.markdown",
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
"beginCaptures": {
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1327,11 +1327,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1353,18 +1353,18 @@
]
},
"fenced_code_block_rust": {
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(rust|rs)(\\s+[^`~]*)?$)",
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(rust|rs|\\{\\.rust.+?\\})(\\s+[^`~]*)?$)",
"name": "markup.fenced_code.block.markdown",
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
"beginCaptures": {
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1393,11 +1393,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1419,18 +1419,18 @@
]
},
"fenced_code_block_shell": {
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init)(\\s+[^`~]*)?$)",
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init|\\{\\.bash.+?\\})(\\s+[^`~]*)?$)",
"name": "markup.fenced_code.block.markdown",
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
"beginCaptures": {
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1459,11 +1459,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1492,11 +1492,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1525,11 +1525,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1558,11 +1558,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1591,11 +1591,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1624,11 +1624,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
@@ -1657,11 +1657,11 @@
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
"4": {
"name": "fenced_code.block.language.markdown"
},
"6": {
"name": "fenced_code.block.language.attributes"
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -241,12 +241,6 @@
"description": "%markdown.preview.scrollPreviewWithEditor.desc%",
"scope": "resource"
},
"markdown.preview.scrollPreviewWithEditorSelection": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollPreviewWithEditorSelection.desc%",
"deprecationMessage": "%markdown.preview.scrollPreviewWithEditorSelection.deprecationMessage%"
},
"markdown.preview.markEditorSelection": {
"type": "boolean",
"default": true,
@@ -279,6 +273,20 @@
"%configuration.markdown.preview.openMarkdownLinks.inEditor%"
]
},
"markdown.links.openLocation": {
"type": "string",
"default": "currentGroup",
"description": "%configuration.markdown.links.openLocation.description%",
"scope": "resource",
"enum": [
"currentGroup",
"beside"
],
"enumDescriptions": [
"%configuration.markdown.links.openLocation.currentGroup%",
"%configuration.markdown.links.openLocation.beside%"
]
},
"markdown.trace": {
"type": "string",
"enum": [

View File

@@ -10,8 +10,6 @@
"markdown.preview.markEditorSelection.desc": "Mark the current editor selection in the markdown preview.",
"markdown.preview.scrollEditorWithPreview.desc": "When a markdown preview is scrolled, update the view of the editor.",
"markdown.preview.scrollPreviewWithEditor.desc": "When a markdown editor is scrolled, update the view of the preview.",
"markdown.preview.scrollPreviewWithEditorSelection.desc": "[Deprecated] Scrolls the markdown preview to reveal the currently selected line from the editor.",
"markdown.preview.scrollPreviewWithEditorSelection.deprecationMessage": "This setting has been replaced by 'markdown.preview.scrollPreviewWithEditor' and no longer has any effect.",
"markdown.preview.title": "Open Preview",
"markdown.previewSide.title": "Open Preview to the Side",
"markdown.showLockedPreviewToSide.title": "Open Locked Preview to the Side",
@@ -21,7 +19,10 @@
"markdown.trace.desc": "Enable debug logging for the markdown extension.",
"markdown.preview.refresh.title": "Refresh Preview",
"markdown.preview.toggleLock.title": "Toggle Preview Locking",
"configuration.markdown.preview.openMarkdownLinks.description": "How should clicking on links to markdown files be handled in the preview.",
"configuration.markdown.preview.openMarkdownLinks.description": "Controls how links to other markdown files in the markdown preview should be opened.",
"configuration.markdown.preview.openMarkdownLinks.inEditor": "Try to open links in the editor",
"configuration.markdown.preview.openMarkdownLinks.inPreview": "Try to open links in the markdown preview"
}
"configuration.markdown.preview.openMarkdownLinks.inPreview": "Try to open links in the markdown preview",
"configuration.markdown.links.openLocation.description": "Controls where links in markdown files should be opened.",
"configuration.markdown.links.openLocation.currentGroup": "Open links in the active editor group.",
"configuration.markdown.links.openLocation.beside": "Open links beside the active editor."
}

View File

@@ -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"
}
}
}

View File

@@ -13,8 +13,14 @@ import { isMarkdownFile } from '../util/file';
export interface OpenDocumentLinkArgs {
path: string;
fragment: string;
readonly path: string;
readonly fragment: string;
readonly fromResource: any;
}
enum OpenMarkdownLinks {
beside = 'beside',
currentGroup = 'currentGroup',
}
export class OpenDocumentLinkCommand implements Command {
@@ -22,10 +28,15 @@ export class OpenDocumentLinkCommand implements Command {
public readonly id = OpenDocumentLinkCommand.id;
public static createCommandUri(
fromResource: vscode.Uri,
path: string,
fragment: string
fragment: string,
): vscode.Uri {
return vscode.Uri.parse(`command:${OpenDocumentLinkCommand.id}?${encodeURIComponent(JSON.stringify({ path: encodeURIComponent(path), fragment }))}`);
return vscode.Uri.parse(`command:${OpenDocumentLinkCommand.id}?${encodeURIComponent(JSON.stringify(<OpenDocumentLinkArgs>{
path: encodeURIComponent(path),
fragment,
fromResource: encodeURIComponent(fromResource.toString(true)),
}))}`);
}
public constructor(
@@ -33,30 +44,45 @@ export class OpenDocumentLinkCommand implements Command {
) { }
public execute(args: OpenDocumentLinkArgs) {
const p = decodeURIComponent(args.path);
return this.tryOpen(p, args).catch(() => {
if (p && extname(p) === '') {
return this.tryOpen(p + '.md', args);
const fromResource = vscode.Uri.parse(decodeURIComponent(args.fromResource));
const targetPath = decodeURIComponent(args.path);
const column = this.getViewColumn(fromResource);
return this.tryOpen(targetPath, args, column).catch(() => {
if (targetPath && extname(targetPath) === '') {
return this.tryOpen(targetPath + '.md', args, column);
}
const resource = vscode.Uri.file(p);
const targetResource = vscode.Uri.file(targetPath);
return Promise.resolve(undefined)
.then(() => vscode.commands.executeCommand('vscode.open', resource))
.then(() => vscode.commands.executeCommand('vscode.open', targetResource, column))
.then(() => undefined);
});
}
private async tryOpen(path: string, args: OpenDocumentLinkArgs) {
private async tryOpen(path: string, args: OpenDocumentLinkArgs, column: vscode.ViewColumn) {
const resource = vscode.Uri.file(path);
if (vscode.window.activeTextEditor && isMarkdownFile(vscode.window.activeTextEditor.document)) {
if (!path || vscode.window.activeTextEditor.document.uri.fsPath === resource.fsPath) {
return this.tryRevealLine(vscode.window.activeTextEditor, args.fragment);
}
}
return vscode.workspace.openTextDocument(resource)
.then(vscode.window.showTextDocument)
.then(document => vscode.window.showTextDocument(document, column))
.then(editor => this.tryRevealLine(editor, args.fragment));
}
private getViewColumn(resource: vscode.Uri): vscode.ViewColumn {
const config = vscode.workspace.getConfiguration('markdown', resource);
const openLinks = config.get<OpenMarkdownLinks>('links.openLocation', OpenMarkdownLinks.currentGroup);
switch (openLinks) {
case OpenMarkdownLinks.beside:
return vscode.ViewColumn.Beside;
case OpenMarkdownLinks.currentGroup:
default:
return vscode.ViewColumn.Active;
}
}
private async tryRevealLine(editor: vscode.TextEditor, fragment?: string) {
if (editor && fragment) {
const toc = new TableOfContentsProvider(this.engine, editor.document);
@@ -107,4 +133,4 @@ async function tryResolveLinkToMarkdownFile(path: string): Promise<vscode.Uri |
return document.uri;
}
return undefined;
}
}

View File

@@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { Disposable } from './util/dispose';
export class DocumentIndex extends Disposable {
private readonly _uriMap = new Map();
constructor() {
super();
for (let doc of vscode.workspace.textDocuments) {
this._registerDoc(doc);
}
this._register(
vscode.workspace.onDidOpenTextDocument((doc) => {
this._registerDoc(doc);
})
);
this._register(
vscode.workspace.onDidCloseTextDocument((doc) => {
this._unregisterDoc(doc.uri);
})
);
}
getByUri(uri: vscode.Uri): vscode.TextDocument | undefined {
return this._uriMap.get(uri.toString());
}
private _registerDoc(doc: vscode.TextDocument) {
const uri = doc.uri.toString();
if (this._uriMap.has(uri)) {
throw new Error(`The document ${uri} is already registered.`);
}
this._uriMap.set(uri, doc);
}
private _unregisterDoc(uri: vscode.Uri) {
if (!this._uriMap.has(uri.toString())) {
throw new Error(`The document ${uri.toString()} is not registered.`);
}
this._uriMap.delete(uri.toString());
}
}

View File

@@ -38,7 +38,7 @@ function parseLink(
}
return {
uri: OpenDocumentLinkCommand.createCommandUri(resourcePath, tempUri.fragment),
uri: OpenDocumentLinkCommand.createCommandUri(document.uri, resourcePath, tempUri.fragment),
tooltip: localize('documentLink.tooltip', 'Follow link')
};
}
@@ -183,4 +183,4 @@ export default class LinkProvider implements vscode.DocumentLinkProvider {
}
return out;
}
}
}

View File

@@ -140,9 +140,9 @@ export class MarkdownPreview extends Disposable {
MarkdownPreview.viewType,
MarkdownPreview.getPreviewTitle(resource, locked),
previewColumn, {
enableFindWidget: true,
...MarkdownPreview.getWebviewOptions(resource, contributionProvider.contributions)
});
enableFindWidget: true,
...MarkdownPreview.getWebviewOptions(resource, contributionProvider.contributions)
});
return new MarkdownPreview(
webview,
@@ -288,12 +288,15 @@ export class MarkdownPreview extends Disposable {
const editor = vscode.window.activeTextEditor;
// Reposition scroll preview, position scroll to the top if active text editor
// doesn't corresponds with preview
if (editor && editor.document.uri.fsPath === resource.fsPath) {
this.line = getVisibleLine(editor);
} else {
this.line = 0;
if (editor) {
if (editor.document.uri.fsPath === resource.fsPath) {
this.line = getVisibleLine(editor);
} else {
this.line = 0;
}
}
// If we have changed resources, cancel any pending updates
const isResourceChange = resource.fsPath !== this._resource.fsPath;
if (isResourceChange) {
@@ -540,7 +543,7 @@ export class MarkdownPreview extends Disposable {
}
}
vscode.commands.executeCommand('_markdown.openDocumentLink', { path, fragment });
vscode.commands.executeCommand('_markdown.openDocumentLink', { path, fragment, fromResource: this.resource });
}
private async onCacheImageSizes(imageInfo: { id: string, width: number, height: number }[]) {

View File

@@ -8,8 +8,9 @@ import { Disposable } from '../util/dispose';
import { isMarkdownFile } from '../util/file';
import { Lazy, lazy } from '../util/lazy';
import MDDocumentSymbolProvider from './documentSymbolProvider';
import { SkinnyTextDocument } from '../tableOfContentsProvider';
import { SkinnyTextDocument, SkinnyTextLine } from '../tableOfContentsProvider';
import { flatten } from '../util/arrays';
import { DocumentIndex } from '../docIndex';
export interface WorkspaceMarkdownDocumentProvider {
getAllMarkdownDocuments(): Thenable<Iterable<SkinnyTextDocument>>;
@@ -26,6 +27,7 @@ class VSCodeWorkspaceMarkdownDocumentProvider extends Disposable implements Work
private readonly _onDidDeleteMarkdownDocumentEmitter = this._register(new vscode.EventEmitter<vscode.Uri>());
private _watcher: vscode.FileSystemWatcher | undefined;
private _docIndex: DocumentIndex = this._register(new DocumentIndex());
async getAllMarkdownDocuments() {
const resources = await vscode.workspace.findFiles('**/*.md', '**/node_modules/**');
@@ -81,12 +83,39 @@ class VSCodeWorkspaceMarkdownDocumentProvider extends Disposable implements Work
}
private async getMarkdownDocument(resource: vscode.Uri): Promise<SkinnyTextDocument | undefined> {
const doc = await vscode.workspace.openTextDocument(resource);
return doc && isMarkdownFile(doc) ? doc : undefined;
const existingDocument = this._docIndex.getByUri(resource);
if (existingDocument) {
return existingDocument;
}
const bytes = await vscode.workspace.fs.readFile(resource);
// We assume that markdown is in UTF-8
const text = Buffer.from(bytes).toString('utf-8');
const lines: SkinnyTextLine[] = [];
const parts = text.split(/(\r?\n)/);
const lineCount = Math.floor(parts.length / 2) + 1;
for (let line = 0; line < lineCount; line++) {
lines.push({
text: parts[line * 2]
});
}
return {
uri: resource,
version: 0,
lineCount: lineCount,
lineAt: (index) => {
return lines[index];
},
getText: () => {
return text;
}
};
}
}
export default class MarkdownWorkspaceSymbolProvider extends Disposable implements vscode.WorkspaceSymbolProvider {
private _symbolCache = new Map<string, Lazy<Thenable<vscode.SymbolInformation[]>>>();
private _symbolCachePopulated: boolean = false;

View File

@@ -134,10 +134,10 @@ export class PreviewSecuritySelector {
description: localize('toggleSecurityWarning.description', 'Does not affect the content security level')
},
], {
placeHolder: localize(
'preview.showPreviewSecuritySelector.title',
'Select security settings for Markdown previews in this workspace'),
});
placeHolder: localize(
'preview.showPreviewSecuritySelector.title',
'Select security settings for Markdown previews in this workspace'),
});
if (!selection) {
return;
}

View File

@@ -15,12 +15,17 @@ export interface TocEntry {
readonly location: vscode.Location;
}
export interface SkinnyTextLine {
text: string;
}
export interface SkinnyTextDocument {
readonly uri: vscode.Uri;
readonly version: number;
readonly lineCount: number;
lineAt(line: number): SkinnyTextLine;
getText(): string;
lineAt(line: number): vscode.TextLine;
}
export class TableOfContentsProvider {
@@ -72,7 +77,8 @@ export class TableOfContentsProvider {
text: TableOfContentsProvider.getHeaderText(line.text),
level: TableOfContentsProvider.getHeaderLevel(heading.markup),
line: lineNumber,
location: new vscode.Location(document.uri, line.range)
location: new vscode.Location(document.uri,
new vscode.Range(lineNumber, 0, lineNumber, line.text.length))
});
}
@@ -85,13 +91,13 @@ export class TableOfContentsProvider {
break;
}
}
const endLine = typeof end === 'number' ? end : document.lineCount - 1;
const endLine = end !== undefined ? end : document.lineCount - 1;
return {
...entry,
location: new vscode.Location(document.uri,
new vscode.Range(
entry.location.range.start,
new vscode.Position(endLine, document.lineAt(endLine).range.end.character)))
new vscode.Position(endLine, document.lineAt(endLine).text.length)))
};
});
}

View File

@@ -41,7 +41,7 @@ class CredentialsFeature extends SqlOpsFeature<any> {
const client = this._client;
let readCredential = (credentialId: string): Thenable<azdata.Credential> => {
return client.sendRequest(Contracts.ReadCredentialRequest.type, { credentialId });
return client.sendRequest(Contracts.ReadCredentialRequest.type, { credentialId, password: undefined });
};
let saveCredential = (credentialId: string, password: string): Thenable<boolean> => {
@@ -49,7 +49,7 @@ class CredentialsFeature extends SqlOpsFeature<any> {
};
let deleteCredential = (credentialId: string): Thenable<boolean> => {
return client.sendRequest(Contracts.DeleteCredentialRequest.type, { credentialId });
return client.sendRequest(Contracts.DeleteCredentialRequest.type, { credentialId, password: undefined });
};
return azdata.credentials.registerProvider({

View File

@@ -55,9 +55,9 @@ class FireWallFeature extends SqlOpsFeature<any> {
}
}, {
handleFirewallRule,
createFirewallRule
});
handleFirewallRule,
createFirewallRule
});
}
}

View File

@@ -20,8 +20,8 @@ import { AppContext } from './appContext';
import { DacFxService } from './dacfx/dacFxService';
import { CmsService } from './cms/cmsService';
import { CompletionExtensionParams, CompletionExtLoadRequest } from './contracts';
const baseConfig = require('./config.json');
import { promisify } from 'util';
import { readFile } from 'fs';
const outputChannel = vscode.window.createOutputChannel(Constants.serviceName);
const statusView = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
@@ -35,7 +35,7 @@ export class SqlToolsServer {
public async start(context: AppContext): Promise<SqlOpsDataClient> {
try {
const installationStart = Date.now();
const path = await this.download();
const path = await this.download(context);
const installationComplete = Date.now();
let serverOptions = generateServerOptions(context.extensionContext.logPath, path);
let clientOptions = getClientOptions(context);
@@ -69,8 +69,9 @@ export class SqlToolsServer {
}
}
private download() {
this.config = JSON.parse(JSON.stringify(baseConfig));
private async download(context: AppContext): Promise<string> {
const rawConfig = await promisify(readFile)(path.join(context.extensionContext.extensionPath, 'config.json'));
this.config = JSON.parse(rawConfig.toString());
this.config.installDirectory = path.join(__dirname, this.config.installDirectory);
this.config.proxy = vscode.workspace.getConfiguration('http').get('proxy');
this.config.strictSSL = vscode.workspace.getConfiguration('http').get('proxyStrictSSL') || true;

View File

@@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "Dependencies shared by all extensions",
"dependencies": {
"typescript": "3.6.1-rc"
"typescript": "3.6.3-insiders.20190909"
},
"scripts": {
"postinstall": "node ./postinstall"

View File

@@ -14,4 +14,4 @@
}
],
"version": 1
}
}

View File

@@ -64,7 +64,7 @@
},
"devDependencies": {
"@types/mocha": "^5.2.5",
"@types/node": "^8.0.24",
"@types/node": "^10.14.8",
"mocha": "^5.2.0",
"should": "^13.2.1",
"typemoq": "^2.1.0",

View File

@@ -273,9 +273,9 @@ export class SchemaCompareDialog {
components: targetComponents
}
], {
horizontal: true,
titleFontSize: titleFontSize
})
horizontal: true,
titleFontSize: titleFontSize
})
.withLayout({
width: '100%',
padding: '10px 10px 0 30px'

View File

@@ -7,10 +7,10 @@
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.6.tgz#b8622d50557dd155e9f2f634b7d68fd38de5e94b"
integrity sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==
"@types/node@^8.0.24":
version "8.10.46"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.46.tgz#12161db48a775e8c69c1cfff2be545610381056f"
integrity sha512-PfnRbk836fFs9T9QnZh0G1k9oC6YXCqIK3LX6vU/6oiXtEBSFCiJFj6UnLZtqIIHTsgMn8Dojq3yhmpwY7QWcw==
"@types/node@^10.14.8":
version "10.14.17"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.17.tgz#b96d4dd3e427382482848948041d3754d40fd5ce"
integrity sha512-p/sGgiPaathCfOtqu2fx5Mu1bcjuP8ALFg4xpGgNkcin7LwRyzUKniEHBKdcE1RPsenq5JVPIpMTJSygLboygQ==
ajv@^6.5.5:
version "6.10.0"

View File

@@ -358,6 +358,10 @@
"diffEditor.removedTextBackground": "#892F4688",
// "diffEditor.removedTextBorder": "",
// Editor: Minimap
"minimap.selectionHighlight": "#750000",
// Workbench: Title
"titleBar.activeBackground": "#10192c",
// "titleBar.activeForeground": "",
@@ -439,4 +443,4 @@
"terminal.ansiBrightCyan": "#78ffff",
"terminal.ansiBrightWhite": "#ffffff"
}
}
}

View File

@@ -17,6 +17,7 @@
"inputOption.activeBorder": "#a57a4c",
"selection.background": "#84613daa",
"editor.selectionBackground": "#84613daa",
"minimap.selectionHighlight": "#84613daa",
"editorWidget.background": "#131510",
"editorHoverWidget.background": "#221a14",
"editorGroupHeader.tabsBackground": "#131510",
@@ -398,4 +399,4 @@
}
}
]
}
}

View File

@@ -11,6 +11,7 @@
"editor.background": "#1e1e1e",
"editor.foreground": "#c5c8c6",
"editor.selectionBackground": "#676b7180",
"minimap.selectionHighlight": "#676b7180",
"editor.selectionHighlightBackground": "#575b6180",
"editor.lineHighlightBackground": "#303030",
"editorLineNumber.activeForeground": "#949494",
@@ -588,4 +589,4 @@
}
}
]
}
}

View File

@@ -23,6 +23,7 @@
"selection.background": "#ccccc7",
"editor.selectionHighlightBackground": "#575b6180",
"editor.selectionBackground": "#878b9180",
"minimap.selectionHighlight": "#878b9180",
"editor.wordHighlightBackground": "#4a4a7680",
"editor.wordHighlightStrongBackground": "#6a6a9680",
"editor.lineHighlightBackground": "#3e3d32",

View File

@@ -499,6 +499,7 @@
"editor.lineHighlightBackground": "#E4F6D4",
"editorLineNumber.activeForeground": "#9769dc",
"editor.selectionBackground": "#C9D0D9",
"minimap.selectionHighlight": "#C9D0D9",
"tab.modifiedBorder": "#f1897f",
"panel.background": "#F5F5F5",
"sideBar.background": "#F2F2F2",
@@ -534,6 +535,8 @@
"errorForeground": "#f1897f",
"badge.background": "#705697AA",
"progressBar.background": "#705697",
"walkThrough.embeddedEditorBackground": "#00000014"
"walkThrough.embeddedEditorBackground": "#00000014",
"editorIndentGuide.background": "#aaaaaa60",
"editorIndentGuide.activeBackground": "#777777b0"
}
}

View File

@@ -21,6 +21,7 @@
"editor.foreground": "#F8F8F8",
"editorWhitespace.foreground": "#c10000",
"editor.selectionBackground": "#750000",
"minimap.selectionHighlight": "#750000",
"editorLineNumber.foreground": "#ff777788",
"editorLineNumber.activeForeground": "#ffbbbb88",
"editorWidget.background": "#300000",
@@ -411,4 +412,4 @@
}
}
]
}
}

View File

@@ -359,6 +359,7 @@
"editor.lineHighlightBackground": "#073642",
"editorLineNumber.activeForeground": "#949494",
"editor.selectionBackground": "#274642",
"minimap.selectionHighlight": "#274642",
"editorIndentGuide.background": "#93A1A180",
"editorIndentGuide.activeBackground": "#C3E1E180",
"editorHoverWidget.background": "#004052",

View File

@@ -350,6 +350,7 @@
"editorWhitespace.foreground": "#586E7580",
"editor.lineHighlightBackground": "#EEE8D5",
"editor.selectionBackground": "#EEE8D5",
"minimap.selectionHighlight": "#EEE8D5",
"editorIndentGuide.background": "#586E7580",
"editorIndentGuide.activeBackground": "#081E2580",
"editorHoverWidget.background": "#CCC4B0",
@@ -486,4 +487,4 @@
// Interactive Playground
"walkThrough.embeddedEditorBackground": "#00000014"
}
}
}

View File

@@ -14,6 +14,7 @@
"editor.background": "#002451",
"editor.foreground": "#ffffff",
"editor.selectionBackground": "#003f8e",
"minimap.selectionHighlight": "#003f8e",
"editor.lineHighlightBackground": "#00346e",
"editorLineNumber.activeForeground": "#949494",
"editorCursor.foreground": "#ffffff",
@@ -255,4 +256,4 @@
}
}
]
}
}

View File

@@ -78,7 +78,6 @@ export function activate(context: vscode.ExtensionContext) {
}
const { updateUrl, commit, quality, serverDataFolderName, dataFolderName } = getProductConfiguration();
const serverCommand = process.platform === 'win32' ? 'server.bat' : 'server.sh';
const commandArgs = ['--port=0', '--disable-telemetry'];
const env = getNewEnv();
const remoteDataDir = process.env['TESTRESOLVER_DATA_FOLDER'] || path.join(os.homedir(), serverDataFolderName || `${dataFolderName}-testresolver`);
@@ -86,13 +85,19 @@ export function activate(context: vscode.ExtensionContext) {
outputChannel.appendLine(`Using data folder at ${remoteDataDir}`);
if (!commit) { // dev mode
const serverCommand = process.platform === 'win32' ? 'server.bat' : 'server.sh';
const vscodePath = path.resolve(path.join(context.extensionPath, '..', '..'));
const serverCommandPath = path.join(vscodePath, 'resources', 'server', 'bin-dev', serverCommand);
extHostProcess = cp.spawn(serverCommandPath, commandArgs, { env, cwd: vscodePath });
} else {
const serverBin = path.join(remoteDataDir, 'bin');
progress.report({ message: 'Installing VSCode Server' });
const serverLocation = await downloadAndUnzipVSCodeServer(updateUrl, commit, quality, serverBin);
const serverCommand = process.platform === 'win32' ? 'server.cmd' : 'server.sh';
let serverLocation = env['VSCODE_REMOTE_SERVER_PATH']; // support environment variable to specify location of server on disk
if (!serverLocation) {
const serverBin = path.join(remoteDataDir, 'bin');
progress.report({ message: 'Installing VSCode Server' });
serverLocation = await downloadAndUnzipVSCodeServer(updateUrl, commit, quality, serverBin);
}
outputChannel.appendLine(`Using server build at ${serverLocation}`);
extHostProcess = cp.spawn(path.join(serverLocation, serverCommand), commandArgs, { env, cwd: serverLocation });

View File

@@ -2,7 +2,7 @@
# yarn lockfile v1
typescript@3.6.1-rc:
version "3.6.1-rc"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.1-rc.tgz#9db650b25d8ef033d9e25b3057bdd1e102bb434b"
integrity sha512-u6AQN9AoocZKYSz8zcc1Qh/V/mbAO+BHc73fTiKlIdjzU60A8TesrK9/7kg3GM8o2RxNyCeOFpcevEtnfUyaLg==
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==