Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support sql cell language highlight in opensumi #391

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion archive/opensumi-module-libro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@difizen/opensumi-module-libro",
"version": "0.1.10",
"version": "0.1.11",
"description": "libro on opensumi",
"repository": {
"type": "git",
Expand Down
12 changes: 0 additions & 12 deletions archive/opensumi-module-libro/src/browser/notebook.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,6 @@ export class NotebookServiceOverride
private readonly textMateService: ITextmateTokenizerService;

async initialize() {
// monaco.languages.register({
// id,
// extensions: ['.sql'],
// aliases: ['sql', 'odps'],
// mimetypes: ['text/sql','application/vnd.libro.sql+json'],
// });
// monaco.languages.onLanguage(id, () => {
// console.log("🚀 ~ monaco.languages.onLanguage ~ id:", id)
// setTokensLanguage();
// });

// console.log("🚀 ~ setTokensLanguage ~ conf:", conf)
try {
import(
/* webpackChunkName: "opensumi-textmate-languages" */ `@opensumi/textmate-languages/es/sql`
Expand Down
12 changes: 8 additions & 4 deletions archive/opensumi-module-libro/src/mana/editor/opensumi-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,6 @@ export class LibroOpensumiEditor implements IEditor {
let modelRef = getOrigin(this.editorState.state);
const options: MonacoEditorOptions = {
...this.toMonacoOptions(editorConfig),
language:
this.languageSpec.language === 'sql-odps'
? 'sql'
: this.languageSpec.language,
};

const editorCollectionService: EditorCollectionService = this.injector.get(
Expand All @@ -503,6 +499,14 @@ export class LibroOpensumiEditor implements IEditor {

getOrigin(this._editor).open(modelRef);

this._editor.monacoEditor
?.getModel()
?.setLanguage(
this.languageSpec.language === 'sql-odps'
? 'sql'
: this.languageSpec.language,
);

this.toDispose.push(
modelRef.instance.getMonacoModel()?.onDidChangeContent((e) => {
const value = this.monacoEditor?.getValue();
Expand Down
Loading