liquidev / lintplus

An improved linting plugin for the lite text editor.
59 stars 7 forks source link

[Litexl] Lintplus causing files to fail to open when lacking a linter submodule #5

Closed Wazubaba closed 2 years ago

Wazubaba commented 3 years ago

Hi, currently lintplus seems to be causing files to refuse to open when they do not have an available linter on a recent git clone of litexl. The stracktrace is as follows:

(forgive any typos, I had to transcribe this by hand because I cannot for the life of me find the actual log file or a way to copy the contents of the log pane)

/opt/litexl/data/plugins/lintplus.lua:253: attempt to index local 'linter' (a nil value) at /opt/litexl/data/core/init.lua:799
stack traceback:
/opt/litexl/data/plugins/lintplus.lua:253: in function 'init_linter_for_doc'
/opt/litexl/data/plugins/lintplus.lua:265: in function 'load'
/opt/litexl/data/plugins/autoreload.lua:53: in function 'load'
/opt/litexl/data/core/doc/init.lua:42: in function 'new'
/opt/litexl/data/plugins/detectindent.lua:123: in function 'new'
/opt/litexl/data/core/object.lua:53: in function 'Doc'
/opt/litexl/data/core/init.lua:747: in function 'open_doc'
/opt/litexl/data/plugins/treeview.lua:222: in function </opt/litexl/data/plugins/treeview.lua:220>
[C]: in function 'xpcall'
/opt/litexl/data/core/init.lua:798: in function 'try'
/opt/litexl/data/plugins/treeview.lua:220: in function 'on_mouse_pressed'
/opt/litexl/data/core/rootview.lua:604: in function 'on_mouse_pressed'
/opt/litexl/data/core/init.lua:821: in function 'on_event'
/opt/litexl/data/plugins/macro.lua:19: in function </opt/litexl/data/plugins/macro.lua:18>
[C]: in function 'xpcall'
/opt/litexl/data/core/init.lua:798: in function 'try'
/opt/litexl/data/core/init.lua:878: in function 'step'
/opt/litexl/data/core/init.lua:958 in function </opt/litexl/data/core/init.lua:954>
(...tail calls...)
[string 'local core..."]:9: in function <[string "local core...']:2>
[C]: in function 'xpcall'
[string "local core..."]:2: in main chunk
Therosin commented 2 years ago

I simply added a check for if a linter was found around line 251, quick fix but it does the job. image

liquidev commented 2 years ago

@Wazubaba @Therosin The thing is, this exact error is already guarded against in the source code.

https://github.com/liquidev/lintplus/blob/6fa359efc9b3cc985e1484f1aaa0d2dc1ca23185/init.lua#L279

The fix seems to have been introduced before the issue was open, so it's possible you forgot to update lint+ when moving it around, or something.

You may be running an outdated version of the plugin. Try git pulling from origin to see if that helps.