Merge pull request #1343 from kevinkjt2000/ponyc
Add Support for Ponylang
This commit is contained in:
commit
608b6dafd4
@ -133,6 +133,7 @@ formatting.
|
|||||||
| PHP | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/flow/tree/master/hack/hackfmt), [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) |
|
| PHP | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/flow/tree/master/hack/hackfmt), [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) |
|
||||||
| PO | [alex](https://github.com/wooorm/alex) !!, [msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html), [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
| PO | [alex](https://github.com/wooorm/alex) !!, [msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html), [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||||
| Pod | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
| Pod | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||||
|
| Pony | [ponyc](https://github.com/ponylang/ponyc) |
|
||||||
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
|
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
|
||||||
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
||||||
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
||||||
|
21
ale_linters/pony/ponyc.vim
Normal file
21
ale_linters/pony/ponyc.vim
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
" Description: ponyc linter for pony files
|
||||||
|
|
||||||
|
call ale#Set('pony_ponyc_executable', 'ponyc')
|
||||||
|
call ale#Set('pony_ponyc_options', '--pass paint')
|
||||||
|
|
||||||
|
function! ale_linters#pony#ponyc#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'pony_ponyc_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#pony#ponyc#GetCommand(buffer) abort
|
||||||
|
return ale_linters#pony#ponyc#GetExecutable(a:buffer)
|
||||||
|
\ . ' ' . ale#Var(a:buffer, 'pony_ponyc_options')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('pony', {
|
||||||
|
\ 'name': 'ponyc',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable_callback': 'ale_linters#pony#ponyc#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale_linters#pony#ponyc#GetCommand',
|
||||||
|
\ 'callback': 'ale#handlers#pony#HandlePonycFormat',
|
||||||
|
\})
|
34
autoload/ale/handlers/pony.vim
Normal file
34
autoload/ale/handlers/pony.vim
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
scriptencoding utf-8
|
||||||
|
" Description: This file defines a handler function which ought to work for
|
||||||
|
" any program which outputs errors in the format that ponyc uses.
|
||||||
|
|
||||||
|
function! s:RemoveUnicodeQuotes(text) abort
|
||||||
|
let l:text = a:text
|
||||||
|
let l:text = substitute(l:text, '[`´‘’]', '''', 'g')
|
||||||
|
let l:text = substitute(l:text, '\v\\u2018([^\\]+)\\u2019', '''\1''', 'g')
|
||||||
|
let l:text = substitute(l:text, '[“”]', '"', 'g')
|
||||||
|
|
||||||
|
return l:text
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale#handlers#pony#HandlePonycFormat(buffer, lines) abort
|
||||||
|
" Look for lines like the following.
|
||||||
|
" /home/code/pony/classes/Wombat.pony:22:30: can't lookup private fields from outside the type
|
||||||
|
|
||||||
|
let l:pattern = '\v^([^:]+):(\d+):(\d+)?:? (.+)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:item = {
|
||||||
|
\ 'filename': l:match[1],
|
||||||
|
\ 'lnum': str2nr(l:match[2]),
|
||||||
|
\ 'col': str2nr(l:match[3]),
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': s:RemoveUnicodeQuotes(l:match[4]),
|
||||||
|
\}
|
||||||
|
|
||||||
|
call add(l:output, l:item)
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
25
doc/ale-pony.txt
Normal file
25
doc/ale-pony.txt
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
===============================================================================
|
||||||
|
ALE Pony Integration *ale-pony-options*
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
ponyc *ale-pony-ponyc*
|
||||||
|
|
||||||
|
g:ale_pony_ponyc_executable *g:ale_pony_ponyc_executable*
|
||||||
|
*b:ale_pony_ponyc_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'ponyc'`
|
||||||
|
|
||||||
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_pony_ponyc_options *g:ale_pony_ponyc_options*
|
||||||
|
*b:ale_pony_ponyc_options*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'--pass paint'`
|
||||||
|
|
||||||
|
This variable can be set to pass options to ponyc.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
@ -160,6 +160,8 @@ CONTENTS *ale-contents*
|
|||||||
write-good..........................|ale-po-write-good|
|
write-good..........................|ale-po-write-good|
|
||||||
pod...................................|ale-pod-options|
|
pod...................................|ale-pod-options|
|
||||||
write-good..........................|ale-pod-write-good|
|
write-good..........................|ale-pod-write-good|
|
||||||
|
pony..................................|ale-pony-options|
|
||||||
|
ponyc...............................|ale-pony-ponyc|
|
||||||
proto.................................|ale-proto-options|
|
proto.................................|ale-proto-options|
|
||||||
protoc-gen-lint.....................|ale-proto-protoc-gen-lint|
|
protoc-gen-lint.....................|ale-proto-protoc-gen-lint|
|
||||||
pug...................................|ale-pug-options|
|
pug...................................|ale-pug-options|
|
||||||
@ -349,6 +351,7 @@ Notes:
|
|||||||
* PHP: `hack`, `hackfmt`, `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`
|
* PHP: `hack`, `hackfmt`, `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`
|
||||||
* PO: `alex`!!, `msgfmt`, `proselint`, `write-good`
|
* PO: `alex`!!, `msgfmt`, `proselint`, `write-good`
|
||||||
* Pod: `alex`!!, `proselint`, `write-good`
|
* Pod: `alex`!!, `proselint`, `write-good`
|
||||||
|
* Pony: `ponyc`
|
||||||
* proto: `protoc-gen-lint`
|
* proto: `protoc-gen-lint`
|
||||||
* Pug: `pug-lint`
|
* Pug: `pug-lint`
|
||||||
* Puppet: `puppet`, `puppet-lint`
|
* Puppet: `puppet`, `puppet-lint`
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
Before:
|
||||||
|
Save g:ale_pony_ponyc_options
|
||||||
|
|
||||||
|
unlet! g:ale_pony_ponyc_options
|
||||||
|
unlet! b:ale_pony_ponyc_options
|
||||||
|
|
||||||
|
runtime ale_linters/pony/ponyc.vim
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
unlet! b:ale_pony_ponyc_options
|
||||||
|
call ale#linter#Reset()
|
||||||
|
|
||||||
|
Execute(The options should be used in the command):
|
||||||
|
AssertEqual
|
||||||
|
\ 'ponyc --pass paint',
|
||||||
|
\ ale_linters#pony#ponyc#GetCommand(bufnr(''))
|
||||||
|
|
||||||
|
let b:ale_pony_ponyc_options = 'foobar'
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ 'ponyc foobar',
|
||||||
|
\ ale_linters#pony#ponyc#GetCommand(bufnr(''))
|
21
test/handler/test_pony_handler.vader
Normal file
21
test/handler/test_pony_handler.vader
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
Execute(The pony handler should handle ponyc output):
|
||||||
|
call ale#test#SetFilename('foo.pony')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ {
|
||||||
|
\ 'filename': '/home/projects/Wombat.pony',
|
||||||
|
\ 'lnum': 22,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'col': 30,
|
||||||
|
\ 'text': 'can''t lookup private fields from outside the type',
|
||||||
|
\ },
|
||||||
|
\ ],
|
||||||
|
\ ale#handlers#pony#HandlePonycFormat(bufnr(''), [
|
||||||
|
\ 'Building builtin -> /usr/lib/pony/0.21.3/packages/builtin',
|
||||||
|
\ 'Building . -> /home/projects',
|
||||||
|
\ 'Error:',
|
||||||
|
\ '/home/projects/Wombat.pony:22:30: can''t lookup private fields from outside the type',
|
||||||
|
\ ' env.out.print(defaultWombat._hunger_level)',
|
||||||
|
\ ' ^',
|
||||||
|
\ ])
|
Loading…
Reference in New Issue
Block a user