Skip to content

Commit a73e64e

Browse files
committed
Workaround cspell bug when cwd contains spaces
... or probably any chars that gets percent encoded when transformed to a URI. cspell translates the given path to a URI but the reporter has a bug where it compares the normal working dir with the percent encoded one. These two never match obviously and then cspell prints the complete percent encoded URI as the filename. We thus (a) teach the regex about these stdin filenames, (b) teach `is_stdin_filename` to always return `True` because the filename the reporter reports is not a filename that can found on the filesystem but an URI. If we return true, SublimeLinter core assumes the current view
1 parent 4076ab1 commit a73e64e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

linter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@
44
class CSpell(Linter):
55
cmd = 'cspell stdin://${file}'
66
defaults = {'selector': 'source'}
7-
regex = r'^(?P<filename>(\S:)?[^:]*):(?P<line>\d+):(?P<col>\d+) - (?P<message>.*)$'
7+
regex = r'^(?P<filename>(stdin:(///)?)?(\S:)?[^:]*):(?P<line>\d+):(?P<col>\d+) - (?P<message>.*)$'
88
error_stream = STREAM_STDOUT
9+
10+
@staticmethod
11+
def is_stdin_filename(filename: str) -> bool:
12+
return True

0 commit comments

Comments
 (0)