SublimeLinter / SublimeLinter-gcc

This linter plugin for SublimeLinter provides an interface to gcc or other gcc-like (cross-)compiler.
MIT License
22 stars 5 forks source link

SublimeLinter 4 will break this plugin #5

Closed braver closed 6 years ago

braver commented 6 years ago

We're working on some big changes to SublimeLinter 4 to improve the UI and overal maintainability. This includes a change that will break compatibility. It's not completely clear on our end on how to fix this, but you can read about it here:

https://github.com/SublimeLinter/SublimeLinter3/issues/728#issuecomment-353728223

We don't have a timeline for SL4, we're currently testing and still making changes so it might be in beta for a few months yet. Feel free to ask questions at https://github.com/SublimeLinter/SublimeLinter3.

jfcherng commented 6 years ago

So for SL4, if I would like to use a dynamic executable, I have to implement my own can_lint and context_sensitive_executable_path, right?

braver commented 6 years ago

@kaste you have the most experience with this, perhaps you can answer that question?

kaste commented 6 years ago

For SL3 the 'correct' way would have been to implement can_lint as well as context_sensitive_executable_path.

For SL4 however, it should be just enough to not set executable at all, which is the same as setting it to None. Then the backwards compatible contract is that cmd() returns a reachable executable at cmd[0]. A reachable executable is either a complete path to an executable, so that in Python speak os.access(path, os.X_OK) will be True, or something a literal which call could resolve.

If that's not enough, you could implement context_sensitive_executable_path. context_sensitive_executable_path(cmd) should return True, <resolved_cmd[0]> for success, True, None if you want to skip linting, or False, None if you want the core SublimeLinter to try to resolve the given cmd. Whatever you return as resolved_cmdwill not be checked again. Here you could even return ['npm', 'run', 'lint'] and SublimeLinter will just take that.

can_lint is a static method. It is run without a view, and thus has no access to any settings. But for example os.environ is ready. It should be implemented if you want to disable the linter, or you have a global executable which you resolve once using env. I don't think you do that.

jfcherng commented 6 years ago

@kaste @braver Thanks for the info. SublimeLinter-contrib-gcc should be compatible with both SL3 and SL4 since 1.3.0.