plugin: linter: Use filepath.Base() to compare the linted file - #4179
Open
4RH1T3CT0R7 wants to merge 1 commit into
Open
plugin: linter: Use filepath.Base() to compare the linted file#41794RH1T3CT0R7 wants to merge 1 commit into
filepath.Base() to compare the linted file#41794RH1T3CT0R7 wants to merge 1 commit into
Conversation
The plugin's own `basename()` only treated `\` as a separator on Windows, so a linter reporting `a/b/d.c` for a buffer opened as `a\b\d.c` produced no match and its messages were silently dropped. Windows accepts both separators and a linter is free to normalize the path it prints. `filepath` is already imported here and `filepath.Base()` handles both separators on Windows while treating `\` as a regular filename character everywhere else, so the hand-rolled helper can go away. Fixes micro-editor#3963
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The linter plugin's
basename()only treats\as a separator on Windows, so it never splits on/. If a linter normalizes the paths it prints, the name it reports can't match the buffer path andonExit()silently drops all its messages. For a buffer opened asa\b\d.c, a linter printinga/b/d.cgets that whole string back out ofbasename()and the compare fails. The default C linters hide this because clang and gcc echo the path back unchanged, so both sides get mangled the same way.filepathis already imported here andfilepath.Base()handles both separators on Windows and treats\as an ordinary filename character elsewhere, so the hand-rolled helper can go.Fixes #3963