fix: handle comments inside brackets

pull/625/head^2
Nikolaj Sidorenco 2024-04-29 16:15:41 +07:00
parent 8d65614998
commit 92cf19c347
No known key found for this signature in database
5 changed files with 83 additions and 36 deletions

@ -1,5 +1,4 @@
let x =
match x with
| Some x -> ()
| None -> ()
/// <summary>
/// doc string
/// </summary>
let f x = $"my string: {x + 1}"

@ -1,9 +1,9 @@
namespace Test
type IProp1 =
abstract member Prop1: string
abstract member Prop2: Array<int>
type IProp2 =
abstract member Prop1: string
abstract member Prop2: Array<int>
/// A is used for...
type A = {
/// B is used for...
B: int
/// C is used for...
C: int
}

@ -31,10 +31,10 @@
[
","
";"
"|"
] @punctuation.delimiter
[
"|"
"="
">"
"<"
@ -42,7 +42,6 @@
"~"
(infix_op)
(prefix_op)
; TODO: split _indent_or_op
] @operator
(attribute) @attribute
@ -55,21 +54,37 @@
"when"
"match"
"match!"
"and"
"or"
"then"
"&&"
"||"
"then"
] @keyword.conditional
[
"and"
"or"
"not"
"upcast"
"downcast"
] @keyword.operator
((identifier) @keyword.debug
(#any-of? @keyword.debug
"print"
"printf"
"printfn"))
[
"return"
"return!"
"yield"
"yield!"
] @keyword.return
[
"for"
"while"
"downto"
"to"
] @keyword.repeat
@ -87,57 +102,54 @@
"mutable"
"override"
"rec"
"global"
(access_modifier)
] @keyword.modifier
[
"let"
"let!"
"use"
"use!"
"member"
] @keyword.function
[
"enum"
"type"
"inherit"
"interface"
] @keyword.type
[
"try"
"with"
"finally"
] @keyword.exception
[
"as"
"assert"
"begin"
"end"
"done"
"default"
"do"
"do!"
"done"
"downcast"
"downto"
"end"
"event"
"field"
"finally"
"fun"
"function"
"get"
"global"
"inherit"
"interface"
"set"
"lazy"
"new"
"not"
"null"
"of"
"param"
"property"
"set"
"struct"
"try"
"upcast"
"use"
"use!"
"val"
"with"
"yield"
"yield!"
"module"
"namespace"
] @keyword
@ -171,7 +183,7 @@
(dot_expression
base: (long_identifier_or_op) @variable.member
base: (_) @variable.member
field: (long_identifier_or_op) @property)
(value_declaration_left (identifier_pattern) @variable)

@ -62,11 +62,13 @@ static inline bool is_infix_op_start(TSLexer *lexer) {
case '&':
case '=':
case '?':
case '/':
case '<':
case '>':
case '^':
return true;
case '/':
skip(lexer);
return lexer->lookahead != '/';
case '.':
skip(lexer);
return lexer->lookahead != '.';

@ -1082,3 +1082,37 @@ type A() =
(long_identifier_or_op
(long_identifier
(identifier)))))))))
================================================================================
record with xml docs on fields
================================================================================
/// A is used for...
type A = {
/// B is used for...
B: int
/// C is used for...
C: int
}
--------------------------------------------------------------------------------
(file
(xml_doc)
(type_definition
(record_type_defn
(type_name
(identifier))
(xml_doc)
(record_fields
(record_field
(identifier)
(type
(long_identifier
(identifier))))
(xml_doc)
(record_field
(identifier)
(type
(long_identifier
(identifier))))))))