mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-17 06:17:12 +09:00
Convert filetypes to language IDs
This commit is contained in:
@@ -411,7 +411,7 @@ func NewBuffer(r io.Reader, size int64, path string, startcursor Loc, btype BufT
|
||||
// initializes an LSP server if possible, or calls didOpen on an existing
|
||||
// LSP server in this workspace
|
||||
func (b *Buffer) lspInit() {
|
||||
ft := b.Settings["filetype"].(string)
|
||||
ft := lsp.Filetype(b.Settings["filetype"].(string))
|
||||
l, ok := lsp.GetLanguage(ft)
|
||||
if ok && l.Installed() {
|
||||
b.Server = lsp.GetServer(l, gopath.Dir(b.AbsPath))
|
||||
|
||||
20
internal/lsp/languages.go
Normal file
20
internal/lsp/languages.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package lsp
|
||||
|
||||
// mappings for when micro filetypes don't match LSP language identifiers
|
||||
var languages = map[string]string{
|
||||
"batch": "bat",
|
||||
"c++": "cpp",
|
||||
"git-rebase-todo": "git-rebase",
|
||||
"html4": "html",
|
||||
"html5": "html",
|
||||
"python2": "python",
|
||||
"shell": "shellscript",
|
||||
// "tex": "latex",
|
||||
}
|
||||
|
||||
func Filetype(ft string) string {
|
||||
if l, ok := languages[ft]; ok {
|
||||
return l
|
||||
}
|
||||
return ft
|
||||
}
|
||||
@@ -76,4 +76,13 @@ install = [["npm", "install", "-g", "vim-language-server"]]
|
||||
command = "purescript-language-server"
|
||||
args = ["--stdio"]
|
||||
install = [["npm", "install", "-g", "purescript-language-server"]]
|
||||
|
||||
[language.verilog]
|
||||
command = "svls"
|
||||
args = []
|
||||
install = [["cargo", "install", "svls"]]
|
||||
|
||||
[language.d]
|
||||
command = "serve-d"
|
||||
args = []
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user