Skip to content

Commit 2ace603

Browse files
authored
Add fsharp language support (helix-editor#7619)
1 parent 86bf0e0 commit 2ace603

File tree

3 files changed

+213
-0
lines changed

3 files changed

+213
-0
lines changed

book/src/generated/lang-support.md

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
| fish |||| |
4444
| forth || | | `forth-lsp` |
4545
| fortran || || `fortls` |
46+
| fsharp || | | `fsautocomplete` |
4647
| gdscript |||| |
4748
| git-attributes || | | |
4849
| git-commit ||| | |

languages.toml

+16
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ erlang-ls = { command = "erlang_ls" }
2626
forc = { command = "forc", args = ["lsp"] }
2727
forth-lsp = { command = "forth-lsp" }
2828
fortls = { command = "fortls", args = ["--lowercase_intrinsics"] }
29+
fsharp-ls = { command = "fsautocomplete", config = { AutomaticWorkspaceInit = true } }
2930
gleam = { command = "gleam", args = ["lsp"] }
3031
haskell-language-server = { command = "haskell-language-server-wrapper", args = ["--lsp"] }
3132
idris2-lsp = { command = "idris2-lsp" }
@@ -2661,6 +2662,21 @@ indent = { tab-width = 3, unit = " " }
26612662
name = "forth"
26622663
source = { git = "https://github.com/alexanderbrevig/tree-sitter-forth", rev = "304ed77beb113e37af38b20ff14e3c37bf350d10" }
26632664

2665+
[[language]]
2666+
name = "fsharp"
2667+
scope = "source.fs"
2668+
roots = ["sln", "fsproj"]
2669+
injection-regex = "fsharp"
2670+
file-types = ["fs", "fsx"]
2671+
comment-token = "//"
2672+
indent = { tab-width = 4, unit = " " }
2673+
auto-format = true
2674+
language-servers = ["fsharp-ls"]
2675+
2676+
[[grammar]]
2677+
name = "fsharp"
2678+
source = { git = "https://github.com/kaashyapan/tree-sitter-fsharp", rev = "1b5a315e003024db6181744f1d25b8f525732665" }
2679+
26642680
[[language]]
26652681
name = "t32"
26662682
scope = "source.t32"

runtime/queries/fsharp/highlights.scm

+196
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
;; ----------------------------------------------------------------------------
2+
;; Literals and comments
3+
4+
[
5+
(line_comment)
6+
(block_comment)
7+
(block_comment_content)
8+
] @comment
9+
10+
11+
;; ----------------------------------------------------------------------------
12+
;; Punctuation
13+
14+
[
15+
"("
16+
")"
17+
"{"
18+
"}"
19+
"["
20+
"]"
21+
"[|"
22+
"|]"
23+
"[<"
24+
">]"
25+
] @punctuation.bracket
26+
27+
[
28+
","
29+
";"
30+
] @punctuation.delimiter
31+
32+
[
33+
"|"
34+
"="
35+
">"
36+
"<"
37+
"-"
38+
"~"
39+
(infix_op)
40+
(prefix_op)
41+
(symbolic_op)
42+
] @operator
43+
44+
45+
46+
(attribute) @attribute
47+
48+
[
49+
"if"
50+
"then"
51+
"else"
52+
"elif"
53+
"when"
54+
"match"
55+
"match!"
56+
"and"
57+
"or"
58+
"&&"
59+
"||"
60+
"then"
61+
] @keyword.control.conditional
62+
63+
[
64+
"return"
65+
"return!"
66+
] @keyword.control.return
67+
68+
[
69+
"for"
70+
"while"
71+
] @keyword.control.return
72+
73+
74+
[
75+
"open"
76+
"#r"
77+
"#load"
78+
] @keyword.control.import
79+
80+
[
81+
"abstract"
82+
"delegate"
83+
"static"
84+
"inline"
85+
"internal"
86+
"mutable"
87+
"override"
88+
"private"
89+
"public"
90+
"rec"
91+
] @keyword.storage.modifier
92+
93+
[
94+
"enum"
95+
"let"
96+
"let!"
97+
"member"
98+
"module"
99+
"namespace"
100+
"type"
101+
] @keyword.storage
102+
103+
[
104+
"as"
105+
"assert"
106+
"begin"
107+
"default"
108+
"do"
109+
"do!"
110+
"done"
111+
"downcast"
112+
"downto"
113+
"end"
114+
"event"
115+
"field"
116+
"finally"
117+
"fun"
118+
"function"
119+
"get"
120+
"global"
121+
"inherit"
122+
"interface"
123+
"lazy"
124+
"new"
125+
"not"
126+
"null"
127+
"of"
128+
"param"
129+
"property"
130+
"set"
131+
"struct"
132+
"try"
133+
"upcast"
134+
"use"
135+
"use!"
136+
"val"
137+
"with"
138+
"yield"
139+
"yield!"
140+
] @keyword
141+
142+
[
143+
"true"
144+
"false"
145+
"unit"
146+
] @constant.builtin
147+
148+
[
149+
(type)
150+
(const)
151+
] @constant
152+
153+
[
154+
(union_type_case)
155+
(rules (rule (identifier_pattern)))
156+
] @type.enum
157+
158+
(fsi_directive_decl (string) @namespace)
159+
160+
[
161+
(import_decl (long_identifier))
162+
(named_module (long_identifier))
163+
(namespace (long_identifier))
164+
(named_module
165+
name: (long_identifier) )
166+
(namespace
167+
name: (long_identifier) )
168+
] @namespace
169+
170+
171+
(dot_expression
172+
base: (long_identifier_or_op) @variable.other.member
173+
field: (long_identifier_or_op) @function)
174+
175+
[
176+
;;(value_declaration_left (identifier_pattern) )
177+
(function_declaration_left (identifier) )
178+
(call_expression (long_identifier_or_op (long_identifier)))
179+
;;(application_expression (long_identifier_or_op (long_identifier)))
180+
] @function
181+
182+
[
183+
(string)
184+
(triple_quoted_string)
185+
] @string
186+
187+
[
188+
(int)
189+
(int16)
190+
(int32)
191+
(int64)
192+
(float)
193+
(decimal)
194+
] @constant.numeric
195+
196+

0 commit comments

Comments
 (0)