Merge from vscode 2f984aad710215f4e4684a035bb02f55d1a9e2cc (#9819)

This commit is contained in:
Anthony Dresser
2020-04-01 00:44:39 -07:00
committed by GitHub
parent 0e27aaa61f
commit 0bfbdc62ed
247 changed files with 5402 additions and 3311 deletions

View File

@@ -28,7 +28,7 @@ export class PreviewManager implements vscode.CustomEditorProvider {
) { }
public async openCustomDocument(uri: vscode.Uri) {
return new vscode.CustomDocument(PreviewManager.viewType, uri);
return new vscode.CustomDocument(uri);
}
public async resolveCustomEditor(

View File

@@ -151,7 +151,7 @@ export class MarkdownPreviewManager extends Disposable implements vscode.Webview
}
public async openCustomDocument(uri: vscode.Uri) {
return new vscode.CustomDocument(this.customEditorViewType, uri);
return new vscode.CustomDocument(uri);
}
public async resolveCustomTextEditor(

View File

@@ -69,7 +69,7 @@ module.exports = function withDefaults(/**@type WebpackConfig*/extConfig) {
// yes, really source maps
devtool: 'source-map',
plugins: [
// @ts-ignore
// @ts-expect-error
new CopyWebpackPlugin([
{ from: 'src', to: '.', ignore: ['**/test/**', '*.ts'] }
]),

View File

@@ -27,7 +27,20 @@
"title": "%signOut%",
"category": "%displayName%"
}
]
],
"configuration": {
"title": "Microsoft Account",
"properties": {
"microsoftAccount.logLevel": {
"type": "string",
"enum": [
"info",
"trace"
],
"default": "info"
}
}
}
},
"scripts": {
"vscode:prepublish": "npm run compile",

View File

@@ -45,6 +45,7 @@ export class Keychain {
async setToken(token: string): Promise<void> {
try {
Logger.trace('Writing to keychain', token);
return await this.keytar.setPassword(SERVICE_ID, ACCOUNT_ID, token);
} catch (e) {
// Ignore
@@ -59,7 +60,9 @@ export class Keychain {
async getToken(): Promise<string | null | undefined> {
try {
return await this.keytar.getPassword(SERVICE_ID, ACCOUNT_ID);
const result = await this.keytar.getPassword(SERVICE_ID, ACCOUNT_ID);
Logger.trace('Reading from keychain', result);
return result;
} catch (e) {
// Ignore
Logger.error(`Getting token failed: ${e}`);

View File

@@ -7,11 +7,23 @@ import * as vscode from 'vscode';
type LogLevel = 'Trace' | 'Info' | 'Error';
enum Level {
Trace = 'trace',
Info = 'Info'
}
class Log {
private output: vscode.OutputChannel;
private level: Level;
constructor() {
this.output = vscode.window.createOutputChannel('Account');
this.level = vscode.workspace.getConfiguration('microsoftAccount').get('logLevel') || Level.Info;
vscode.workspace.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('microsoftAccount.logLevel')) {
this.level = vscode.workspace.getConfiguration('microsoftAccount').get('logLevel') || Level.Info;
}
});
}
private data2String(data: any): string {
@@ -32,6 +44,12 @@ class Log {
this.logLevel('Error', message, data);
}
public trace(message: string, data?: any): void {
if (this.level === Level.Trace) {
this.logLevel('Trace', message, data);
}
}
public logLevel(level: LogLevel, message: string, data?: any): void {
this.output.appendLine(`[${level} - ${this.now()}] ${message}`);
if (data) {

View File

@@ -1,68 +1,59 @@
{
"name": "vscode-colorize-tests",
"description": "Colorize tests for VS Code",
"version": "0.0.1",
"publisher": "vscode",
"license": "MIT",
"private": true,
"activationEvents": [
"onLanguage:json"
],
"main": "./out/colorizerTestMain",
"enableProposedApi": true,
"engines": {
"vscode": "*"
},
"scripts": {
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-colorize-tests ./tsconfig.json"
},
"dependencies": {
"jsonc-parser": "2.2.1"
},
"devDependencies": {
"@types/node": "^12.11.7",
"mocha-junit-reporter": "^1.17.0",
"mocha-multi-reporters": "^1.1.7",
"vscode": "1.1.5"
},
"contributes": {
"semanticTokenTypes": [
{
"id": "testToken",
"description": "A test token"
}
],
"semanticTokenModifiers": [
{
"id": "testModifier",
"description": "A test modifier"
}
],
"semanticTokenStyleDefaults": [
{
"selector": "testToken",
"scope": [ "entity.name.function.special" ]
},
{
"selector": "*.testModifier",
"light": {
"fontStyle": "bold"
},
"dark": {
"fontStyle": "bold"
},
"highContrast": {
"fontStyle": "bold"
}
}
],
"productIconThemes": [
{
"id": "Test Product Icons",
"label": "The Test Product Icon Theme",
"path": "./producticons/test-product-icon-theme.json",
"_watch": true
}
]
}
"name": "vscode-colorize-tests",
"description": "Colorize tests for VS Code",
"version": "0.0.1",
"publisher": "vscode",
"license": "MIT",
"private": true,
"activationEvents": [
"onLanguage:json"
],
"main": "./out/colorizerTestMain",
"enableProposedApi": true,
"engines": {
"vscode": "*"
},
"scripts": {
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-colorize-tests ./tsconfig.json"
},
"dependencies": {
"jsonc-parser": "2.2.1"
},
"devDependencies": {
"@types/node": "^12.11.7",
"mocha-junit-reporter": "^1.17.0",
"mocha-multi-reporters": "^1.1.7",
"vscode": "1.1.5"
},
"contributes": {
"semanticTokenTypes": [
{
"id": "testToken",
"description": "A test token"
}
],
"semanticTokenModifiers": [
{
"id": "testModifier",
"description": "A test modifier"
}
],
"semanticTokenScopes": [
{
"scopes": {
"testToken": [
"entity.name.function.special"
]
}
}
],
"productIconThemes": [
{
"id": "Test Product Icons",
"label": "The Test Product Icon Theme",
"path": "./producticons/test-product-icon-theme.json",
"_watch": true
}
]
}
}

View File

@@ -56,7 +56,7 @@ export function activate(context: vscode.ExtensionContext): any {
};
jsoncParser.visit(document.getText(), visitor);
return new vscode.SemanticTokens(builder.build());
return builder.build();
}
};