author | wenzelm |
Mon, 12 Jun 2017 15:40:40 +0200 | |
changeset 66070 | 65a68dcd95c3 |
parent 66060 | b2bfbefd354f |
child 66071 | 8b67040b80ce |
permissions | -rw-r--r-- |
66052
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
1 |
'use strict'; |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
2 |
|
66070
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
3 |
import * as library from './library' |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
4 |
import { Disposable, DocumentSelector, ExtensionContext, extensions } from 'vscode'; |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
5 |
|
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
6 |
|
66052
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
7 |
export type Symbol = string |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
8 |
|
66060
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
9 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
10 |
/* ASCII characters */ |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
11 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
12 |
export function is_char(s: string): boolean |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
13 |
{ return s.length == 1 } |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
14 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
15 |
export function is_ascii_letter(s: string): boolean |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
16 |
{ return is_char(s) && "A" <= s && s <= "Z" || "a" <= s && s <= "z" } |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
17 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
18 |
export function is_ascii_digit(s: string): boolean |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
19 |
{ return is_char(s) && "0" <= s && s <= "9" } |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
20 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
21 |
export function is_ascii_quasi(s: string): boolean |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
22 |
{ return s == "_" || s == "'" } |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
23 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
24 |
export function is_ascii_letdig(s: string): boolean |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
25 |
{ return is_ascii_letter(s) || is_ascii_digit(s) || is_ascii_quasi(s) } |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
26 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
27 |
export function is_ascii_identifier(s: String): boolean |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
28 |
{ |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
29 |
const n = s.length |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
30 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
31 |
let all_letdig = true |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
32 |
for (const c of s) { all_letdig = all_letdig && is_ascii_letdig(c) } |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
33 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
34 |
return n > 0 && is_ascii_letter(s.charAt(0)) && all_letdig |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
35 |
} |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
36 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
37 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
38 |
/* named symbols */ |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
39 |
|
66052
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
40 |
export interface Entry |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
41 |
{ |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
42 |
symbol: Symbol, |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
43 |
name: string, |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
44 |
code: number |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
45 |
} |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
46 |
|
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
47 |
let symbol_entries: [Entry] |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
48 |
const names = new Map<Symbol, string>() |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
49 |
const codes = new Map<Symbol, number>() |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
50 |
|
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
51 |
export function get_name(sym: Symbol): string | undefined |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
52 |
{ |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
53 |
return names.get(sym) |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
54 |
} |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
55 |
|
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
56 |
export function get_code(sym: Symbol): number | undefined |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
57 |
{ |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
58 |
return codes.get(sym) |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
59 |
} |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
60 |
|
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
61 |
export function get_unicode(sym: Symbol): string |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
62 |
{ |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
63 |
const code = get_code(sym) |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
64 |
return code ? String.fromCharCode(code) : "" |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
65 |
} |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
66 |
|
66070
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
67 |
function update_entries(entries: [Entry]) |
66052
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
68 |
{ |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
69 |
symbol_entries = entries |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
70 |
names.clear |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
71 |
codes.clear |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
72 |
for (const entry of entries) { |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
73 |
names.set(entry.symbol, entry.name) |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
74 |
codes.set(entry.symbol, entry.code) |
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
75 |
} |
66060
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
76 |
} |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
77 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
78 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
79 |
/* completion */ |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
80 |
|
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
81 |
export function complete_name(prefix: string): [string] |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
82 |
{ |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
83 |
let result = [] as [string] |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
84 |
for (const entry of names) { |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
85 |
if (entry[1].startsWith(prefix)) { result.push(entry[0]) } |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
86 |
} |
b2bfbefd354f
symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents:
66052
diff
changeset
|
87 |
return result.sort() |
66070
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
88 |
} |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
89 |
|
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
90 |
|
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
91 |
/* prettify symbols mode */ |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
92 |
|
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
93 |
interface PrettyStyleProperties |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
94 |
{ |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
95 |
border?: string |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
96 |
textDecoration?: string |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
97 |
color?: string |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
98 |
backgroundColor?: string |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
99 |
} |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
100 |
|
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
101 |
interface PrettyStyle extends PrettyStyleProperties |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
102 |
{ |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
103 |
dark?: PrettyStyleProperties |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
104 |
light?: PrettyStyleProperties |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
105 |
} |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
106 |
|
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
107 |
interface Substitution |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
108 |
{ |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
109 |
ugly: string |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
110 |
pretty: string |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
111 |
pre?: string |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
112 |
post?: string |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
113 |
style?: PrettyStyle |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
114 |
} |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
115 |
|
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
116 |
interface LanguageEntry |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
117 |
{ |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
118 |
language: DocumentSelector |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
119 |
revealOn: string |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
120 |
adjustCursorMovement: boolean |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
121 |
substitutions: Substitution[] |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
122 |
} |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
123 |
|
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
124 |
interface PrettifySymbolsMode |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
125 |
{ |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
126 |
onDidEnabledChange: (handler: (enabled: boolean) => void) => Disposable |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
127 |
isEnabled: () => boolean, |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
128 |
registerSubstitutions: (substitutions: LanguageEntry) => Disposable |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
129 |
} |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
130 |
|
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
131 |
export function init(context: ExtensionContext, entries: [Entry]) |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
132 |
{ |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
133 |
update_entries(entries) |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
134 |
|
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
135 |
const prettify_symbols_mode = |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
136 |
extensions.getExtension<PrettifySymbolsMode>("siegebell.prettify-symbols-mode") |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
137 |
if (prettify_symbols_mode) { |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
138 |
prettify_symbols_mode.activate().then(() => |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
139 |
{ |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
140 |
const substitutions = [] as [Substitution] |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
141 |
for (const entry of names) { |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
142 |
const sym = entry[0] |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
143 |
substitutions.push( |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
144 |
{ |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
145 |
ugly: library.escape_regex(sym), |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
146 |
pretty: library.escape_regex(get_unicode(sym)) |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
147 |
}) |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
148 |
} |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
149 |
for (const language of ["isabelle", "isabelle-ml", "isabelle-output"]) { |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
150 |
context.subscriptions.push( |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
151 |
prettify_symbols_mode.exports.registerSubstitutions( |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
152 |
{ |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
153 |
language: language, |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
154 |
revealOn: "none", |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
155 |
adjustCursorMovement: true, |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
156 |
substitutions: substitutions |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
157 |
})) |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
158 |
} |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
159 |
}) |
65a68dcd95c3
dynamic configuration of prettify-symbols-mode, similar to VSCoq;
wenzelm
parents:
66060
diff
changeset
|
160 |
} |
66052
39eb61b1fa51
provide information about Isabelle symbols within VSCode;
wenzelm
parents:
diff
changeset
|
161 |
} |