mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-12-26 04:08:21 +01:00
SUpport to change language mode in antedit
This commit is contained in:
parent
cda5ff741e
commit
42bc787eae
@ -6,4 +6,5 @@ The editor functionality can be extended by its extension mechanism.
|
||||
Extension can be developed/released/isntalled by the editor itself.
|
||||
|
||||
### Change logs
|
||||
- 0.1.8-a: Allow to change language mode
|
||||
- 0.1.7-a: Add keyboard shortcut support to extension actions
|
@ -6,4 +6,5 @@ The editor functionality can be extended by its extension mechanism.
|
||||
Extension can be developed/released/isntalled by the editor itself.
|
||||
|
||||
### Change logs
|
||||
- 0.1.8-a: Allow to change language mode
|
||||
- 0.1.7-a: Add keyboard shortcut support to extension actions
|
File diff suppressed because one or more lines are too long
@ -7,7 +7,7 @@
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "mrsang@iohub.dev"
|
||||
},
|
||||
"version":"0.1.7-a",
|
||||
"version":"0.1.8-a",
|
||||
"category":"Development",
|
||||
"iconclass":"bi bi-journal-code",
|
||||
"mimes":[
|
||||
|
Binary file not shown.
@ -7,7 +7,7 @@
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "mrsang@iohub.dev"
|
||||
},
|
||||
"version":"0.1.7-a",
|
||||
"version":"0.1.8-a",
|
||||
"category":"Development",
|
||||
"iconclass":"bi bi-journal-code",
|
||||
"mimes":[
|
||||
|
@ -102,7 +102,10 @@ namespace OS {
|
||||
getModes(): GenericObject<any>[] {
|
||||
//const list = [];
|
||||
//return list;
|
||||
return monaco.languages.getLanguages();
|
||||
return monaco.languages.getLanguages().map(e=>{
|
||||
(e as GenericObject<any>).text = e.aliases[0];
|
||||
return e;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -131,6 +134,9 @@ namespace OS {
|
||||
* @memberof MonacoEditorModel
|
||||
*/
|
||||
setMode(m: GenericObject<any>): void {
|
||||
monaco.editor.setModelLanguage(this.editor.getModel(), m.id);
|
||||
if(this.onstatuschange)
|
||||
this.onstatuschange(this.getEditorStatus());
|
||||
}
|
||||
|
||||
|
||||
|
@ -216,14 +216,6 @@ namespace OS {
|
||||
$(wrapper).css('visibility', 'visible');
|
||||
this.setup();
|
||||
this.eum.active.openFile(file);
|
||||
|
||||
/*this.load(new Promise((resolve, reject) => {
|
||||
require.config({ paths: { 'vs': "pkg://MonacoCore/vs".asFileHandle().getlink() }});
|
||||
require(['vs/editor/editor.main'], () => {
|
||||
|
||||
resolve(undefined);
|
||||
});
|
||||
}))*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -321,7 +313,29 @@ namespace OS {
|
||||
if (this.setting.showBottomBar === undefined) {
|
||||
this.setting.showBottomBar = false;
|
||||
}
|
||||
//TODO: support change editor model languages
|
||||
const extension = {
|
||||
name: "Editor",
|
||||
text: __("Editor")
|
||||
};
|
||||
const action = {
|
||||
name: "langmode",
|
||||
text: __("Change language mode"),
|
||||
shortcut: 'CTRL-K'
|
||||
}
|
||||
this.eum.addAction(extension, action, async (e) =>
|
||||
{
|
||||
try{
|
||||
const data = await this.openDialog("SelectionDialog", {
|
||||
"title": __("Select language"),
|
||||
data: this.eum.active.getModes()
|
||||
});
|
||||
this.eum.active.setMode(data);
|
||||
}catch(e)
|
||||
{
|
||||
|
||||
}
|
||||
});
|
||||
this.loadExtensionMetaData();
|
||||
this.toggleSideBar();
|
||||
this.toggleSplitMode();
|
||||
|
Loading…
Reference in New Issue
Block a user