diff options
| author | Michiel van den Heuvel <michielvdnheuvel@gmail.com> | 2024-05-28 12:49:55 +0200 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2024-05-30 05:52:27 -0600 |
| commit | a7aac1044856abc4d1f133c6563fc604d7fe6295 (patch) | |
| tree | 8b77c14267785920d49f9ec3e44b9e699c420fda /lua/plugins/filetype.lua | |
| parent | 9bfb31fcbee028eaecce75a743f2a0bd50b5807c (diff) | |
| download | vis-a7aac1044856abc4d1f133c6563fc604d7fe6295.tar.gz vis-a7aac1044856abc4d1f133c6563fc604d7fe6295.tar.xz | |
Fail silently when syntax has no lexer
This'll patch vis.lexers.load to return nil when the lexer could not be
found. Previously it would've errored out, which the load in lexer.lua
still will as this is used in lexers themselves.
Another possibility is to only patch set_syntax in vis.lua and the
WIN_HIGHLIGHT handler in vis-std.lua, but as most references to
vis.lexers.load already handle a nil return, this seems better.
Diffstat (limited to 'lua/plugins/filetype.lua')
| -rw-r--r-- | lua/plugins/filetype.lua | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua index 553e79d..d643f82 100644 --- a/lua/plugins/filetype.lua +++ b/lua/plugins/filetype.lua @@ -506,15 +506,7 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) for _, cmd in pairs(filetype.cmd or {}) do vis:command(cmd) end - if not vis.lexers.property then return end - local path = vis.lexers.property['scintillua.lexers']:gsub(';', '/?.lua;') - local lexname = filetype.alt_name or syntax - local lexpath = package.searchpath(lexname, path) - if lexpath ~= nil then - win:set_syntax(lexname) - else - win:set_syntax(nil) - end + win:set_syntax(filetype.alt_name or syntax) end local path = win.file.name -- filepath |
