spion / purscheck

A tiny wrapper for the purescript compiler compatible with flycheck
MIT License
13 stars 1 forks source link

Any Chance we could make this work in Sublime Text? #2

Open Fresheyeball opened 9 years ago

Fresheyeball commented 9 years ago

I tried emacs specifically for purscheck, but just can't abandon my beloved sublime text. Do you have any idea what it would take to make it work?

spion commented 9 years ago

Hi,

Reading http://www.sublimelinter.com/en/latest/creating_a_linter.html it looks like it could be made to work. We'd probably need to

Fresheyeball commented 9 years ago

Where is the regex in purescript.el I'm not seeing it. Also why pass the paths twice? And what do you mean by temporary file?

spion commented 9 years ago

The regex is defined using the rx macro syntax in this part of the file. (Sorry about that) It captures file-name, line, column and message

I took that from flycheck's haskell error parser and modified it a little for purescript. I think that the equivalent regex string in python would be

r'^(?:Error at |")(?P<filename>[^"]+)\"? \(?line (?P<line>\d+), column (?P<column>\d+)\)?:\s*\n(?P<message>\s*.+(?:\n *.+)*)$'

purscheck accepts two arguments:

purscheck takes the content of the temporary file, but uses the actual file to find .purescript-paths - that way it can run on unsaved buffers

Fresheyeball commented 9 years ago

When you say it takes the arguments, the temporary file and the actual file. Do you mean the files themselves (some kind of file object), or the file paths (strings)?

spion commented 9 years ago

File paths, because thats what flycheck provides. Although I suppose it wouldn't be too hard to add stdin support for the editor buffer.