@xh/hoist 79.0.0-SNAPSHOT.1765846193322 → 79.0.0-SNAPSHOT.1765846827962
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/desktop/cmp/input/CodeInput.ts +12 -11
- package/package.json +2 -6
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -11,9 +11,11 @@ import {
|
|
|
11
11
|
foldGutter,
|
|
12
12
|
foldKeymap,
|
|
13
13
|
indentOnInput,
|
|
14
|
+
LanguageDescription,
|
|
14
15
|
LanguageSupport,
|
|
15
16
|
syntaxHighlighting
|
|
16
17
|
} from '@codemirror/language';
|
|
18
|
+
import {languages} from '@codemirror/language-data';
|
|
17
19
|
import {linter, lintGutter} from '@codemirror/lint';
|
|
18
20
|
import {highlightSelectionMatches, search} from '@codemirror/search';
|
|
19
21
|
import {
|
|
@@ -50,7 +52,7 @@ import {action, bindable, makeObservable, observable} from '@xh/hoist/mobx';
|
|
|
50
52
|
import {withDefault} from '@xh/hoist/utils/js';
|
|
51
53
|
import {getLayoutProps} from '@xh/hoist/utils/react';
|
|
52
54
|
import classNames from 'classnames';
|
|
53
|
-
import {compact, isEmpty, isFunction, isObject} from 'lodash';
|
|
55
|
+
import {compact, find, includes, isEmpty, isFunction, isObject} from 'lodash';
|
|
54
56
|
import {ReactElement} from 'react';
|
|
55
57
|
import './CodeInput.scss';
|
|
56
58
|
import {javascript} from '@codemirror/lang-javascript';
|
|
@@ -477,9 +479,9 @@ class CodeInputModel extends HoistInputModel {
|
|
|
477
479
|
extensions.push(highlightActiveLine(), highlightActiveLineGutter());
|
|
478
480
|
if (autoFocus) extensions.push(this.autofocusExtension);
|
|
479
481
|
if (language) {
|
|
480
|
-
const langExt = this.
|
|
482
|
+
const langExt = this.getLanguageExtensionAsync(language);
|
|
481
483
|
if (langExt) {
|
|
482
|
-
extensions.push(langExt);
|
|
484
|
+
extensions.push(await langExt);
|
|
483
485
|
} else {
|
|
484
486
|
console.warn('Failed to load language:', language);
|
|
485
487
|
}
|
|
@@ -501,15 +503,14 @@ class CodeInputModel extends HoistInputModel {
|
|
|
501
503
|
sql: sql
|
|
502
504
|
};
|
|
503
505
|
|
|
504
|
-
private
|
|
505
|
-
if (!lang) return null;
|
|
506
|
-
const extFactory = this.LANGUAGE_EXTENSIONS[lang.toLowerCase()];
|
|
507
|
-
if (!extFactory) {
|
|
508
|
-
console.warn(`Language not found: ${lang}`);
|
|
509
|
-
return null;
|
|
510
|
-
}
|
|
506
|
+
private async getLanguageExtensionAsync(lang: string): Promise<LanguageSupport> {
|
|
511
507
|
try {
|
|
512
|
-
|
|
508
|
+
const langDesc: LanguageDescription | undefined = find(
|
|
509
|
+
languages,
|
|
510
|
+
it => includes(it.alias, lang) || it.name.toLowerCase() === lang.toLowerCase()
|
|
511
|
+
);
|
|
512
|
+
if (!langDesc) return null;
|
|
513
|
+
return await langDesc.load();
|
|
513
514
|
} catch (err) {
|
|
514
515
|
console.error(`Failed to load language: ${lang}`, err);
|
|
515
516
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "79.0.0-SNAPSHOT.
|
|
3
|
+
"version": "79.0.0-SNAPSHOT.1765846827962",
|
|
4
4
|
"description": "Hoist add-on for building and deploying React Applications.",
|
|
5
5
|
"repository": "github:xh/hoist-react",
|
|
6
6
|
"homepage": "https://xh.io",
|
|
@@ -34,12 +34,8 @@
|
|
|
34
34
|
"@blueprintjs/datetime": "^5.3.7",
|
|
35
35
|
"@blueprintjs/datetime2": "^2.3.7",
|
|
36
36
|
"@codemirror/commands": "6.10.0",
|
|
37
|
-
"@codemirror/lang-css": "6.3.1",
|
|
38
|
-
"@codemirror/lang-html": "6.4.11",
|
|
39
|
-
"@codemirror/lang-javascript": "6.2.4",
|
|
40
|
-
"@codemirror/lang-json": "6.0.2",
|
|
41
|
-
"@codemirror/lang-sql": "6.10.0",
|
|
42
37
|
"@codemirror/language": "6.11.3",
|
|
38
|
+
"@codemirror/language-data": "6.5.2",
|
|
43
39
|
"@codemirror/lint": "6.9.2",
|
|
44
40
|
"@codemirror/search": "6.5.11",
|
|
45
41
|
"@codemirror/view": "6.39.4",
|