Skip to content

plugin: linter: Use filepath.Base() to compare the linted file - #4179

Open
4RH1T3CT0R7 wants to merge 1 commit into
micro-editor:masterfrom
4RH1T3CT0R7:fix/3963
Open

plugin: linter: Use filepath.Base() to compare the linted file#4179
4RH1T3CT0R7 wants to merge 1 commit into
micro-editor:masterfrom
4RH1T3CT0R7:fix/3963

Conversation

@4RH1T3CT0R7

@4RH1T3CT0R7 4RH1T3CT0R7 commented Aug 24, 2026

Copy link
Copy Markdown

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 and onExit() silently drops all its messages. For a buffer opened as a\b\d.c, a linter printing a/b/d.c gets that whole string back out of basename() 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.

filepath is already imported here and filepath.Base() handles both separators on Windows and treats \ as an ordinary filename character elsewhere, so the hand-rolled helper can go.

Fixes #3963

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

@JoeKar JoeKar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks legit to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error with forward slashes in linter plugin on windows

2 participants