Komodo / KomodoEdit

Komodo Edit is a fast and free multi-language code editor. Written in JS, Python, C++ and based on the Mozilla platform.
http://www.komodoide.com/komodo-edit
Other
2.16k stars 302 forks source link

Change file type using Commando #2115

Open Defman21 opened 8 years ago

Defman21 commented 8 years ago

Short Summary

In Sublime Text, you can change file type using their "Commando". I'd want to see similar feature in Komodo as well.

mitchell-as commented 8 years ago

Thanks for the suggestion. I've wanted this too.

th3coop commented 8 years ago

You could do something like

var cmds = require("ko/commands");
var supportedLangauges= [/*array of all languages*/];
for ( let lang of supportedLangauges)
{
    cmds.register("set_file_lang-"+lang,
           ko.views.manager.do_ViewAs(lang);
}

Anyone know a quick way to get the list of supported languages dynamically?

Defman21 commented 8 years ago

You could look into the code of file type widget in status bar :)

th3coop commented 8 years ago

@Defman21 Yes I certainly could.

Naatan commented 8 years ago

Sounds like a new SDK ;)

Defman21 commented 8 years ago
var langService = Components.classes["@activestate.com/koLanguageRegistryService;1"]. getService(Components.interfaces.koILanguageRegistryService);
var langs = {};
var cmds = require("ko/commands");
langService.getLanguageNames(langs, {});

for (let lang of langs.value) {
    cmds.register("set_file_lang-"+lang,
           ko.views.manager.do_ViewAs(lang));
}

Something like that. Probably it won't work.

dreftymac commented 7 years ago

Alternative approach

See also: