Skip to content

Commit

Permalink
Fix reason syntax (#60)
Browse files Browse the repository at this point in the history
* Fix reason syntax

The change was incorrect and due to the change, the highlighting didn't work anymore. We cannot match within a multiline string because it needs to match an "extension point" everything that happens inside that extension point is basically taken care of by the language extension. I also removed the extra items in contains, I am not sure why that needs to be there because it contains no reason at all, just GraphQL syntax. Also, the current change is independent of the reason-syntax you use.

* A few tweaks to make the tests pass

- Be more lenient with whitespace matches (more still to do)
- Remove the vim-reasonml-specific syntax check
- Remove the unnecessary 'filetype' setting

Co-authored-by: Jon Parise <jon@indelible.org>
  • Loading branch information
jfrolich and jparise authored Sep 7, 2020
1 parent e64fba4 commit 59ea49f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lint: .bundle/vim-vimhelplint
-c 'verb VimhelpLintEcho' \
-c q

test: .bundle/vader.vim .bundle/vim-javascript .bundle/vim-reasonml
test: .bundle/vader.vim .bundle/vim-javascript
cd test && vim -EsNu vimrc --not-a-term -c 'Vader! * */*'

.bundle/vader.vim:
Expand All @@ -19,8 +19,5 @@ test: .bundle/vader.vim .bundle/vim-javascript .bundle/vim-reasonml
.bundle/vim-javascript:
git clone --depth 1 https://github.com/pangloss/vim-javascript.git .bundle/vim-javascript

.bundle/vim-reasonml:
git clone --depth 1 https://github.com/jordwalke/vim-reasonml .bundle/vim-reasonml

.bundle/vim-vimhelplint:
git clone --depth 1 https://github.com/machakann/vim-vimhelplint.git .bundle/vim-vimhelplint
2 changes: 1 addition & 1 deletion after/syntax/reason/graphql.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ if exists('s:current_syntax')
let b:current_syntax = s:current_syntax
endif

syntax region graphqlMultilineString matchgroup=reasonMultilineString start=+graphql\_s*\zs{|+ end=+|}+ contains=@GraphQLSyntax,reasonEscape,reasonEscapeUnicode,reasonEscapeError,reasonStringContinuation keepend
syntax region graphqlMultilineString start=/\[%graphql\s*\n*\s*{|/ end=/|}\s*\n\s*\]/ contains=@GraphQLSyntax keepend
3 changes: 0 additions & 3 deletions test/reason/vim-reasonml.vader
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
Before:
source ../after/syntax/reason/graphql.vim

Execute (Expected syntax groups):
Assert graphql#has_syntax_group('graphqlMultilineString')

Given reason (Template):
[%graphql {|
query UserQuery {
Expand Down

0 comments on commit 59ea49f

Please sign in to comment.