From b7edffe244581b428a4b4da4ff6a08ab461b018f Mon Sep 17 00:00:00 2001 From: Christophe MASSOLIN Date: Mon, 27 Apr 2020 00:11:04 +0200 Subject: Started rust-analyzer.cargo.defaultTarget implementation --- editors/code/package.json | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index b8aaa07d8..fe330fb43 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -237,6 +237,14 @@ "default": false, "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" }, + "rust-analyzer.cargo.rustc.defaultTarget": { + "type": [ + "null", + "string" + ], + "default": null, + "description": "Specify the default target" + }, "rust-analyzer.rustfmt.extraArgs": { "type": "array", "items": { -- cgit v1.2.3 From ed5af989f431b9bfabf6f67350587add05a1942c Mon Sep 17 00:00:00 2001 From: Christophe MASSOLIN Date: Tue, 28 Apr 2020 00:15:54 +0200 Subject: [config] rename cargo.defaultTarget --- editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index fe330fb43..775bdaf17 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -237,7 +237,7 @@ "default": false, "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" }, - "rust-analyzer.cargo.rustc.defaultTarget": { + "rust-analyzer.cargo.defaultTarget": { "type": [ "null", "string" -- cgit v1.2.3 From 0ab4340cdb31ac4d50f039f0a56ebaff86710eb7 Mon Sep 17 00:00:00 2001 From: Christophe MASSOLIN Date: Tue, 5 May 2020 18:01:54 +0200 Subject: Rename `defaultTarget` to target --- editors/code/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index 775bdaf17..d363e9fbb 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -237,13 +237,13 @@ "default": false, "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" }, - "rust-analyzer.cargo.defaultTarget": { + "rust-analyzer.cargo.target": { "type": [ "null", "string" ], "default": null, - "description": "Specify the default target" + "description": "Specify the compilation target" }, "rust-analyzer.rustfmt.extraArgs": { "type": "array", -- cgit v1.2.3 From c22660179c3f892a56ad5bacfddd4c2ec563d35e Mon Sep 17 00:00:00 2001 From: guigui64 Date: Tue, 5 May 2020 22:44:39 +0200 Subject: add the allFeatures flag (true by default) --- editors/code/package.json | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index a05a69752..97276339f 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -296,6 +296,11 @@ "default": true, "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)" }, + "rust-analyzer.checkOnSave.allFeatures": { + "type": "boolean", + "default": true, + "markdownDescription": "Check with all features (will be passed as `--all-features`)" + }, "rust-analyzer.inlayHints.typeHints": { "type": "boolean", "default": true, -- cgit v1.2.3 From 5eac2d4c55fec5f96d84d20cc033c2a8e938f53e Mon Sep 17 00:00:00 2001 From: veetaha Date: Wed, 6 May 2020 00:39:29 +0300 Subject: Drop dead code and a dependency! --- editors/code/package-lock.json | 5 -- editors/code/package.json | 1 - editors/code/src/color_theme.ts | 129 ---------------------------------------- 3 files changed, 135 deletions(-) delete mode 100644 editors/code/src/color_theme.ts (limited to 'editors/code') diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index 55ba5351d..71c627a2a 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json @@ -1066,11 +1066,6 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, - "jsonc-parser": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.1.tgz", - "integrity": "sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w==" - }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", diff --git a/editors/code/package.json b/editors/code/package.json index 97276339f..eeb3d3513 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -33,7 +33,6 @@ "fix": " tsfmt -r && eslint -c .eslintrc.js --ext ts ./src --fix" }, "dependencies": { - "jsonc-parser": "^2.2.1", "node-fetch": "^2.6.0", "vscode-languageclient": "7.0.0-next.1" }, diff --git a/editors/code/src/color_theme.ts b/editors/code/src/color_theme.ts deleted file mode 100644 index 5b9327b28..000000000 --- a/editors/code/src/color_theme.ts +++ /dev/null @@ -1,129 +0,0 @@ -import * as fs from 'fs'; -import * as jsonc from 'jsonc-parser'; -import * as path from 'path'; -import * as vscode from 'vscode'; - -export interface TextMateRuleSettings { - foreground?: string; - background?: string; - fontStyle?: string; -} - -export class ColorTheme { - private rules: Map = new Map(); - - static load(): ColorTheme { - // Find out current color theme - const themeName = vscode.workspace - .getConfiguration('workbench') - .get('colorTheme'); - - if (typeof themeName !== 'string') { - // console.warn('workbench.colorTheme is', themeName) - return new ColorTheme(); - } - return loadThemeNamed(themeName); - } - - static fromRules(rules: TextMateRule[]): ColorTheme { - const res = new ColorTheme(); - for (const rule of rules) { - const scopes = typeof rule.scope === 'undefined' - ? [] - : typeof rule.scope === 'string' - ? [rule.scope] - : rule.scope; - - for (const scope of scopes) { - res.rules.set(scope, rule.settings); - } - } - return res; - } - - lookup(scopes: string[]): TextMateRuleSettings { - let res: TextMateRuleSettings = {}; - for (const scope of scopes) { - this.rules.forEach((value, key) => { - if (scope.startsWith(key)) { - res = mergeRuleSettings(res, value); - } - }); - } - return res; - } - - mergeFrom(other: ColorTheme) { - other.rules.forEach((value, key) => { - const merged = mergeRuleSettings(this.rules.get(key), value); - this.rules.set(key, merged); - }); - } -} - -function loadThemeNamed(themeName: string): ColorTheme { - function isTheme(extension: vscode.Extension): boolean { - return ( - extension.extensionKind === vscode.ExtensionKind.UI && - extension.packageJSON.contributes && - extension.packageJSON.contributes.themes - ); - } - - const themePaths: string[] = vscode.extensions.all - .filter(isTheme) - .flatMap( - ext => ext.packageJSON.contributes.themes - .filter((it: any) => (it.id || it.label) === themeName) - .map((it: any) => path.join(ext.extensionPath, it.path)) - ); - - const res = new ColorTheme(); - for (const themePath of themePaths) { - res.mergeFrom(loadThemeFile(themePath)); - } - - const globalCustomizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); - res.mergeFrom(ColorTheme.fromRules(globalCustomizations?.textMateRules ?? [])); - - const themeCustomizations: any = vscode.workspace.getConfiguration('editor.tokenColorCustomizations').get(`[${themeName}]`); - res.mergeFrom(ColorTheme.fromRules(themeCustomizations?.textMateRules ?? [])); - - - return res; -} - -function loadThemeFile(themePath: string): ColorTheme { - let text; - try { - text = fs.readFileSync(themePath, 'utf8'); - } catch { - return new ColorTheme(); - } - const obj = jsonc.parse(text); - const tokenColors: TextMateRule[] = obj?.tokenColors ?? []; - const res = ColorTheme.fromRules(tokenColors); - - for (const include of obj?.include ?? []) { - const includePath = path.join(path.dirname(themePath), include); - res.mergeFrom(loadThemeFile(includePath)); - } - - return res; -} - -interface TextMateRule { - scope: string | string[]; - settings: TextMateRuleSettings; -} - -function mergeRuleSettings( - defaultSetting: TextMateRuleSettings | undefined, - override: TextMateRuleSettings, -): TextMateRuleSettings { - return { - foreground: override.foreground ?? defaultSetting?.foreground, - background: override.background ?? defaultSetting?.background, - fontStyle: override.fontStyle ?? defaultSetting?.fontStyle, - }; -} -- cgit v1.2.3