aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/color_theme.ts8
-rw-r--r--editors/code/src/highlighting.ts3
-rw-r--r--editors/code/tsconfig.json3
-rw-r--r--editors/emacs/rust-analyzer.el13
4 files changed, 19 insertions, 8 deletions
diff --git a/editors/code/src/color_theme.ts b/editors/code/src/color_theme.ts
index cbad47f35..d816f617d 100644
--- a/editors/code/src/color_theme.ts
+++ b/editors/code/src/color_theme.ts
@@ -28,9 +28,11 @@ export class ColorTheme {
28 static fromRules(rules: TextMateRule[]): ColorTheme { 28 static fromRules(rules: TextMateRule[]): ColorTheme {
29 const res = new ColorTheme(); 29 const res = new ColorTheme();
30 for (const rule of rules) { 30 for (const rule of rules) {
31 const scopes = typeof rule.scope === 'string' 31 const scopes = typeof rule.scope === 'undefined'
32 ? [rule.scope] 32 ? []
33 : rule.scope; 33 : typeof rule.scope === 'string'
34 ? [rule.scope]
35 : rule.scope;
34 for (const scope of scopes) { 36 for (const scope of scopes) {
35 res.rules.set(scope, rule.settings); 37 res.rules.set(scope, rule.settings);
36 } 38 }
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts
index 014e96f75..fc7cd5a1c 100644
--- a/editors/code/src/highlighting.ts
+++ b/editors/code/src/highlighting.ts
@@ -1,7 +1,6 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient'; 2import * as lc from 'vscode-languageclient';
3import * as seedrandom_ from 'seedrandom'; 3import seedrandom from 'seedrandom';
4const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular2-library/issues/221#issuecomment-355945207
5 4
6import { ColorTheme, TextMateRuleSettings } from './color_theme'; 5import { ColorTheme, TextMateRuleSettings } from './color_theme';
7 6
diff --git a/editors/code/tsconfig.json b/editors/code/tsconfig.json
index e60eb8e5e..1ea433961 100644
--- a/editors/code/tsconfig.json
+++ b/editors/code/tsconfig.json
@@ -13,7 +13,8 @@
13 "noUnusedParameters": true, 13 "noUnusedParameters": true,
14 "noImplicitReturns": true, 14 "noImplicitReturns": true,
15 "noFallthroughCasesInSwitch": true, 15 "noFallthroughCasesInSwitch": true,
16 "newLine": "LF" 16 "newLine": "LF",
17 "esModuleInterop": true,
17 }, 18 },
18 "exclude": [ 19 "exclude": [
19 "node_modules" 20 "node_modules"
diff --git a/editors/emacs/rust-analyzer.el b/editors/emacs/rust-analyzer.el
index 06db4f15f..9b426fcae 100644
--- a/editors/emacs/rust-analyzer.el
+++ b/editors/emacs/rust-analyzer.el
@@ -38,7 +38,9 @@
38 38
39(defconst rust-analyzer--action-handlers 39(defconst rust-analyzer--action-handlers
40 '(("rust-analyzer.applySourceChange" . 40 '(("rust-analyzer.applySourceChange" .
41 (lambda (p) (rust-analyzer--apply-source-change-command p))))) 41 (lambda (p) (rust-analyzer--apply-source-change-command p)))
42 ("rust-analyzer.selectAndApplySourceChange" .
43 (lambda (p) (rust-analyzer--select-and-apply-source-change-command p)))))
42 44
43(defun rust-analyzer--uri-filename (text-document) 45(defun rust-analyzer--uri-filename (text-document)
44 (lsp--uri-to-path (gethash "uri" text-document))) 46 (lsp--uri-to-path (gethash "uri" text-document)))
@@ -71,6 +73,12 @@
71 (let ((data (-> p (ht-get "arguments") (lsp-seq-first)))) 73 (let ((data (-> p (ht-get "arguments") (lsp-seq-first))))
72 (rust-analyzer--apply-source-change data))) 74 (rust-analyzer--apply-source-change data)))
73 75
76(defun rust-analyzer--select-and-apply-source-change-command (p)
77 (let* ((options (-> p (ht-get "arguments") (lsp-seq-first)))
78 (chosen-option (lsp--completing-read "Select option:" options
79 (-lambda ((&hash "label")) label))))
80 (rust-analyzer--apply-source-change chosen-option)))
81
74(lsp-register-client 82(lsp-register-client
75 (make-lsp-client 83 (make-lsp-client
76 :new-connection (lsp-stdio-connection (lambda () rust-analyzer-command)) 84 :new-connection (lsp-stdio-connection (lambda () rust-analyzer-command))
@@ -143,7 +151,8 @@
143 151
144(defun rust-analyzer-run (runnable) 152(defun rust-analyzer-run (runnable)
145 (interactive (list (rust-analyzer--select-runnable))) 153 (interactive (list (rust-analyzer--select-runnable)))
146 (-let (((&hash "env" "bin" "args" "label") runnable)) 154 (-let* (((&hash "env" "bin" "args" "label") runnable)
155 (compilation-environment (-map (-lambda ((k v)) (concat k "=" v)) (ht-items env))))
147 (compilation-start 156 (compilation-start
148 (string-join (append (list bin) args '()) " ") 157 (string-join (append (list bin) args '()) " ")
149 ;; cargo-process-mode is nice, but try to work without it... 158 ;; cargo-process-mode is nice, but try to work without it...