mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 21:24:33 +08:00
Fix #4505 - Handle spaces in markdown fences
This commit is contained in:
@@ -117,7 +117,7 @@ function! ale#hover#ParseLSPResult(contents) abort
|
|||||||
for l:line in split(l:item, "\n")
|
for l:line in split(l:item, "\n")
|
||||||
if l:fence_language is v:null
|
if l:fence_language is v:null
|
||||||
" Look for the start of a code fence. (```python, etc.)
|
" Look for the start of a code fence. (```python, etc.)
|
||||||
let l:match = matchlist(l:line, '^```\(.*\)$')
|
let l:match = matchlist(l:line, '^``` *\([^ ]\+\) *$')
|
||||||
|
|
||||||
if !empty(l:match)
|
if !empty(l:match)
|
||||||
let l:fence_language = l:match[1]
|
let l:fence_language = l:match[1]
|
||||||
|
|||||||
@@ -172,6 +172,29 @@ Execute(Simple markdown formatting should be handled):
|
|||||||
\ 'formatted \_ line \_',
|
\ 'formatted \_ line \_',
|
||||||
\ ], "\n"))
|
\ ], "\n"))
|
||||||
|
|
||||||
|
Execute(Fences padded with spaces should be handled):
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ [
|
||||||
|
\ 'unlet! b:current_syntax',
|
||||||
|
\ 'syntax include @ALE_hover_python syntax/python.vim',
|
||||||
|
\ 'syntax region ALE_hover_1 start=/\%1l/ end=/\%3l/ contains=@ALE_hover_python',
|
||||||
|
\ ],
|
||||||
|
\ [
|
||||||
|
\ 'def foo():',
|
||||||
|
\ ' pass',
|
||||||
|
\ '',
|
||||||
|
\ 'formatted _ line _',
|
||||||
|
\ ],
|
||||||
|
\ ],
|
||||||
|
\ ale#hover#ParseLSPResult(join([
|
||||||
|
\ '``` python ',
|
||||||
|
\ 'def foo():',
|
||||||
|
\ ' pass',
|
||||||
|
\ '```',
|
||||||
|
\ 'formatted \_ line \_',
|
||||||
|
\ ], "\n"))
|
||||||
|
|
||||||
Execute(Non-existent syntax files shouldn't be loaded):
|
Execute(Non-existent syntax files shouldn't be loaded):
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
|
|||||||
Reference in New Issue
Block a user