@xh/hoist 79.0.0-SNAPSHOT.1765833120742 → 79.0.0-SNAPSHOT.1765843522401
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 +36 -33
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
foldGutter,
|
|
12
12
|
foldKeymap,
|
|
13
13
|
indentOnInput,
|
|
14
|
-
LanguageSupport,
|
|
15
14
|
syntaxHighlighting
|
|
16
15
|
} from '@codemirror/language';
|
|
17
16
|
import {linter, lintGutter} from '@codemirror/lint';
|
|
@@ -54,10 +53,10 @@ import {compact, isEmpty, isFunction, isObject} from 'lodash';
|
|
|
54
53
|
import {ReactElement} from 'react';
|
|
55
54
|
import './CodeInput.scss';
|
|
56
55
|
import {javascript} from '@codemirror/lang-javascript';
|
|
57
|
-
import {json} from '@codemirror/lang-json';
|
|
58
|
-
import {html} from '@codemirror/lang-html';
|
|
59
|
-
import {sql} from '@codemirror/lang-sql';
|
|
60
|
-
import {css} from '@codemirror/lang-css';
|
|
56
|
+
// import {json} from '@codemirror/lang-json';
|
|
57
|
+
// import {html} from '@codemirror/lang-html';
|
|
58
|
+
// import {sql} from '@codemirror/lang-sql';
|
|
59
|
+
// import {css} from '@codemirror/lang-css';
|
|
61
60
|
export interface CodeInputProps extends HoistProps, HoistInputProps, LayoutProps {
|
|
62
61
|
/** True to focus the control on render. */
|
|
63
62
|
autoFocus?: boolean;
|
|
@@ -418,7 +417,6 @@ class CodeInputModel extends HoistInputModel {
|
|
|
418
417
|
private async getExtensionsAsync(): Promise<Extension[]> {
|
|
419
418
|
const {
|
|
420
419
|
autoFocus,
|
|
421
|
-
language,
|
|
422
420
|
readonly,
|
|
423
421
|
highlightActiveLine: propsHighlightActiveLine,
|
|
424
422
|
linter: propsLinter,
|
|
@@ -444,6 +442,7 @@ class CodeInputModel extends HoistInputModel {
|
|
|
444
442
|
indentOnInput(),
|
|
445
443
|
autocompletion(),
|
|
446
444
|
history(),
|
|
445
|
+
javascript(),
|
|
447
446
|
// Linter
|
|
448
447
|
propsLinter
|
|
449
448
|
? linter(async view => {
|
|
@@ -476,8 +475,14 @@ class CodeInputModel extends HoistInputModel {
|
|
|
476
475
|
if (propsHighlightActiveLine)
|
|
477
476
|
extensions.push(highlightActiveLine(), highlightActiveLineGutter());
|
|
478
477
|
if (autoFocus) extensions.push(this.autofocusExtension);
|
|
479
|
-
if (language)
|
|
480
|
-
|
|
478
|
+
// if (language) {
|
|
479
|
+
// const langExt = this.getLanguageExtension(language);
|
|
480
|
+
// if (langExt) {
|
|
481
|
+
// extensions.push(langExt);
|
|
482
|
+
// } else {
|
|
483
|
+
// console.warn('Failed to load language:', language);
|
|
484
|
+
// }
|
|
485
|
+
// }
|
|
481
486
|
return extensions.filter(it => !isEmpty(it));
|
|
482
487
|
}
|
|
483
488
|
|
|
@@ -486,31 +491,29 @@ class CodeInputModel extends HoistInputModel {
|
|
|
486
491
|
return XH.darkTheme ? oneDark : lightTheme;
|
|
487
492
|
}
|
|
488
493
|
|
|
489
|
-
private LANGUAGE_EXTENSIONS: Record<string, () => LanguageSupport> = {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
private
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
513
|
-
}
|
|
494
|
+
// private LANGUAGE_EXTENSIONS: Record<string, () => LanguageSupport> = {
|
|
495
|
+
// js: javascript,
|
|
496
|
+
// javascript: javascript,
|
|
497
|
+
// html: html,
|
|
498
|
+
// css: css,
|
|
499
|
+
// json: json,
|
|
500
|
+
// sql: sql
|
|
501
|
+
// };
|
|
502
|
+
|
|
503
|
+
// private getLanguageExtension(lang: string): LanguageSupport {
|
|
504
|
+
// if (!lang) return null;
|
|
505
|
+
// const extFactory = this.LANGUAGE_EXTENSIONS[lang.toLowerCase()];
|
|
506
|
+
// if (!extFactory) {
|
|
507
|
+
// console.warn(`Language not found: ${lang}`);
|
|
508
|
+
// return null;
|
|
509
|
+
// }
|
|
510
|
+
// try {
|
|
511
|
+
// return extFactory(); // returns a LanguageSupport instance
|
|
512
|
+
// } catch (err) {
|
|
513
|
+
// console.error(`Failed to load language: ${lang}`, err);
|
|
514
|
+
// return null;
|
|
515
|
+
// }
|
|
516
|
+
// }
|
|
514
517
|
|
|
515
518
|
private autofocusExtension = ViewPlugin.fromClass(
|
|
516
519
|
class {
|
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.1765843522401",
|
|
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",
|