Skip to content

Commit 1dca4e1

Browse files
authored
Allow $ character in type names (#96)
Add `$` as a keyword character since it is allowed in Dart identifiers. This fixes the behavior of the `w` word motion as well as allows syntax groups to match across the character. Refactor the `dartTypeName` regex. Use an optional `_` at the beginning, rather than repeating the pattern with and without `_`. Use the `\u` character class instead of the group `[A-Z]`. Replace the `\w` character class with a group that includes the same characters and adds `$`.
1 parent f8486e5 commit 1dca4e1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

ftplugin/dart.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ let &l:errorformat =
2525

2626
setlocal includeexpr=dart#resolveUri(v:fname)
2727
setlocal isfname+=:
28+
setlocal iskeyword+=$
2829

2930
let b:undo_ftplugin = 'setl et< fo< sw< sts< com< cms< inex< isf<'

syntax/dart.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ syntax match dartNumber "\<\d\+\(\.\d\+\)\=\>"
5353

5454
" User Types
5555
if !exists('dart_highlight_types') || dart_highlight_types
56-
syntax match dartTypeName "\<[A-Z]\w*\>\|\<_[A-Z]\w*\>"
56+
syntax match dartTypeName "\<_\?\u[[:alnum:]_\$]*\>"
5757
endif
5858

5959
" Core libraries

0 commit comments

Comments
 (0)