Added support for linting of proto files#1098
Conversation
- added docs
| \ 'name': 'protoc-gen-lint', | ||
| \ 'output_stream': 'stderr', | ||
| \ 'executable': 'protoc', | ||
| \ 'command': 'protoc --lint_out=. *.proto', |
There was a problem hiding this comment.
It looks like *.proto is for checking files in the current directory. That will be expanded in the shell. Does this program read the file from stdin at all?
|
hmm there seems to be no options for reading from stdin. Is there any bash hackery that can be done to pipe stdin to it? I played around with some things but I couldn't get it to work |
|
If the linter needs to look at files on disk, use |
|
ok, I am now getting an error because the EDIT: I managed to get it working with the EDIT2: I see from reading other PR's that this needs to be usable without bash specific commands so I'll work on writing a |
| \ 'output_stream': 'stderr', | ||
| \ 'lint_file': 1, | ||
| \ 'executable': 'protoc', | ||
| \ 'command': 'protoc -I $(dirname %s) --lint_out=. %s', |
There was a problem hiding this comment.
You've got the right idea about using 'command_callback' here. What you should do is write a callback with 'command_callback' and add ale#Escape(expand('#' . a:buffer . ':p:h')) into the command to add the escaped directory name. That will work everywhere. Then add a test for the command callback in the test/command_callback directory. There are a few similar tests.
|
I have what I think is a working function here (just from looking at others and copying) but I get an error when I open vim that says this is the file as it is when it gives the error. I have tried numerous things and nothing has gotten it to work EDIT: It was a file naming issue. It appears the file name needed to match the function name. vim script is weird |
- added test for command_callback
|
|
||
| return 'protoc' | ||
| \ . ' -I ' . ale#Escape(l:dirname) | ||
| \ . ' --lint_out=. ' . ale#Escape(l:filename) |
There was a problem hiding this comment.
You can use just %s on the end there. ALE will automatically replace that with the filename.
| let l:dirname = expand('#' . a:buffer . ':p:h') | ||
| let l:filename = expand('#' . a:buffer) | ||
|
|
||
| "\ 'command': 'protoc -I $(dirname %s) --lint_out=. %s', |
| pod...................................|ale-pod-options| | ||
| write-good..........................|ale-pod-write-good| | ||
| proto.................................|ale-proto-options| | ||
| protoc..............................|ale-proto-protoc| |
There was a problem hiding this comment.
Remove this entry and the documentation entry. There's no such linter with the name protoc.
|
@w0rp after the test failed I tried every which way I could think of to add all failed for me |
|
Put |
w0rp
left a comment
There was a problem hiding this comment.
Okay, looks good. I'll add it to the README and the list in doc/ale.txt.
* Added support for linting of proto files * Added function to get the proper protoc command
I can add tests if they are necessary. I am not too familiar with vimscript so if tests are necessary some advice would be useful. Thanks