Skip to content

Commit 18ff32a

Browse files
authored
feat(documentation): add tact as language of code blocks for better highlighting in Helix/Neovim (#139)
1 parent af02e49 commit 18ff32a

File tree

6 files changed

+46
-46
lines changed

6 files changed

+46
-46
lines changed

server/src/documentation/documentation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {Node as SyntaxNode} from "web-tree-sitter"
55
import {trimPrefix} from "@server/utils/strings"
66

77
const CODE_FENCE = "```"
8-
const DOC_TMPL = `${CODE_FENCE}\n{signature}\n${CODE_FENCE}\n{documentation}\n`
8+
const DOC_TMPL = `${CODE_FENCE}tact\n{signature}\n${CODE_FENCE}\n{documentation}\n`
99

1010
/**
1111
* Returns the documentation for the given symbol in Markdown format, or null

server/src/e2e/suite/testcases/documentation/basic.test

+11-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fun foo() {
77
let <caret>value = 10;
88
}
99
------------------------------------------------------------------------
10-
```
10+
```tact
1111
let value: Int = 10
1212
```
1313

@@ -20,7 +20,7 @@ fun foo() {
2020
let <caret>value: Int = 10;
2121
}
2222
------------------------------------------------------------------------
23-
```
23+
```tact
2424
let value: Int = 10
2525
```
2626

@@ -34,7 +34,7 @@ fun foo() {
3434
foreach (<caret>key, value in map) {}
3535
}
3636
------------------------------------------------------------------------
37-
```
37+
```tact
3838
let key: Int
3939
```
4040

@@ -48,7 +48,7 @@ fun foo() {
4848
foreach (key, <caret>value in map) {}
4949
}
5050
------------------------------------------------------------------------
51-
```
51+
```tact
5252
let value: Int
5353
```
5454

@@ -61,7 +61,7 @@ fun foo() {
6161
try {} catch (<caret>error) {}
6262
}
6363
------------------------------------------------------------------------
64-
```
64+
```tact
6565
catch(error)
6666
```
6767

@@ -74,7 +74,7 @@ fun foo(<caret>param: Int) {
7474

7575
}
7676
------------------------------------------------------------------------
77-
```
77+
```tact
7878
param: Int
7979
```
8080

@@ -89,7 +89,7 @@ fun foo() {
8989
<caret>FOO;
9090
}
9191
------------------------------------------------------------------------
92-
```
92+
```tact
9393
const FOO: Int = 100
9494
```
9595

@@ -106,7 +106,7 @@ contract Foo {
106106
}
107107
}
108108
------------------------------------------------------------------------
109-
```
109+
```tact
110110
contract Foo
111111
const FOO: Int = 100
112112
```
@@ -120,7 +120,7 @@ contract Foo {
120120
const FOO: <caret>Int = 100;
121121
}
122122
------------------------------------------------------------------------
123-
```
123+
```tact
124124
primitive Int
125125
```
126126

@@ -133,7 +133,7 @@ Top level file comment
133133
contract <caret>Foo {
134134
}
135135
------------------------------------------------------------------------
136-
```
136+
```tact
137137
contract Foo
138138
```
139139
And this is documentation comment
@@ -147,7 +147,7 @@ Line separator in comment
147147
contract <caret>Foo {
148148
}
149149
------------------------------------------------------------------------
150-
```
150+
```tact
151151
contract Foo
152152
```
153153
Some comment. And other!

server/src/e2e/suite/testcases/documentation/contracts.test

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ contract <caret>Foo {
77
value: Int;
88
}
99
------------------------------------------------------------------------
10-
```
10+
```tact
1111
contract Foo
1212
```
1313
Some cool contract
@@ -23,7 +23,7 @@ contract <caret>Foo with Other {
2323
value: Int;
2424
}
2525
------------------------------------------------------------------------
26-
```
26+
```tact
2727
contract Foo with Other
2828
```
2929
Some cool contract
@@ -36,7 +36,7 @@ contract Foo {
3636
get fun <caret>foo() {}
3737
}
3838
------------------------------------------------------------------------
39-
```
39+
```tact
4040
contract Foo
4141
get fun foo()
4242
```
@@ -52,7 +52,7 @@ contract Foo {
5252
fun <caret>foo() {}
5353
}
5454
------------------------------------------------------------------------
55-
```
55+
```tact
5656
contract Foo
5757
fun foo()
5858
```
@@ -71,7 +71,7 @@ contract Foo {
7171
}
7272
}
7373
------------------------------------------------------------------------
74-
```
74+
```tact
7575
contract Foo
7676
field: Int
7777
```
@@ -89,7 +89,7 @@ contract Foo {
8989
}
9090
}
9191
------------------------------------------------------------------------
92-
```
92+
```tact
9393
contract Foo
9494
field: Int = 0
9595
```
@@ -107,7 +107,7 @@ contract Foo {
107107
}
108108
}
109109
------------------------------------------------------------------------
110-
```
110+
```tact
111111
contract Foo
112112
const FOO: Int = 0
113113
```
@@ -127,7 +127,7 @@ contract Foo with WithFoo {
127127
}
128128
}
129129
------------------------------------------------------------------------
130-
```
130+
```tact
131131
trait WithFoo
132132
const FOO: Int = 0
133133
```

server/src/e2e/suite/testcases/documentation/functions.test

+13-13
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ native <caret>test3();
99

1010
native <caret>test4();
1111
------------------------------------------------------------------------
12-
```
12+
```tact
1313
fun test1()
1414
```
15-
```
15+
```tact
1616
extends fun test2()
1717
```
18-
```
18+
```tact
1919
@name(__foo)
2020
native test3()
2121
```
22-
```
22+
```tact
2323
native test4()
2424
```
2525

@@ -31,7 +31,7 @@ primitive Int;
3131

3232
fun <caret>test(name: String, age: Int) {}
3333
------------------------------------------------------------------------
34-
```
34+
```tact
3535
fun test(name: String, age: Int)
3636
```
3737

@@ -43,7 +43,7 @@ primitive Int;
4343

4444
fun <caret>test(name: String): String {}
4545
------------------------------------------------------------------------
46-
```
46+
```tact
4747
fun test(name: String): String
4848
```
4949

@@ -53,11 +53,11 @@ Asm function documentation
5353
asm fun <caret>test() { ONE TWO THREE }
5454
asm(self other) fun <caret>test() { b{00} PUSHSLICE }
5555
------------------------------------------------------------------------
56-
```
56+
```tact
5757
asm fun test() { ONE TWO THREE }
5858
```
5959
Gas: `~36`
60-
```
60+
```tact
6161
asm(self other) fun test() { b{00} PUSHSLICE }
6262
```
6363
Gas: `~22`
@@ -67,7 +67,7 @@ Asm function documentation with one line body
6767
========================================================================
6868
asm fun <caret>test() { ONE }
6969
------------------------------------------------------------------------
70-
```
70+
```tact
7171
asm fun test() { ONE }
7272
```
7373
Gas: `18`
@@ -79,7 +79,7 @@ asm fun <caret>test() {
7979
ONE
8080
}
8181
------------------------------------------------------------------------
82-
```
82+
```tact
8383
asm fun test()
8484
```
8585
Gas: `18`
@@ -92,7 +92,7 @@ fun <caret>test() {
9292
test();
9393
}
9494
------------------------------------------------------------------------
95-
```
95+
```tact
9696
fun test()
9797
```
9898
This is one line comment
@@ -105,7 +105,7 @@ fun <caret>test() {
105105
test();
106106
}
107107
------------------------------------------------------------------------
108-
```
108+
```tact
109109
fun test()
110110
```
111111
This is one line comment
@@ -138,7 +138,7 @@ Function documentation with complex /// doc comment
138138
///
139139
asm fun <caret>getOriginalFwdFee(fwdFee: Int, isMasterchain: Bool): Int { GETORIGINALFWDFEE }
140140
------------------------------------------------------------------------
141-
```
141+
```tact
142142
asm fun getOriginalFwdFee(fwdFee: Int, isMasterchain: Bool): Int { GETORIGINALFWDFEE }
143143
```
144144

server/src/e2e/suite/testcases/documentation/structs.test

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct <caret>Foo {
77
value: Int;
88
}
99
------------------------------------------------------------------------
10-
```
10+
```tact
1111
struct Foo {
1212
name: String;
1313
value: Int;
@@ -24,7 +24,7 @@ message <caret>Foo {
2424
value: Int;
2525
}
2626
------------------------------------------------------------------------
27-
```
27+
```tact
2828
message Foo {
2929
name: String;
3030
value: Int;
@@ -41,7 +41,7 @@ message(0x178d4519) <caret>Foo {
4141
value: Int;
4242
}
4343
------------------------------------------------------------------------
44-
```
44+
```tact
4545
message(0x178d4519) Foo {
4646
name: String;
4747
value: Int;
@@ -62,7 +62,7 @@ fun foo() {
6262
let f = Foo { <caret>field: 10 };
6363
}
6464
------------------------------------------------------------------------
65-
```
65+
```tact
6666
struct Foo
6767
field: Int
6868
```
@@ -81,7 +81,7 @@ fun foo() {
8181
f.<caret>field;
8282
}
8383
------------------------------------------------------------------------
84-
```
84+
```tact
8585
struct Foo
8686
field: Int
8787
```
@@ -100,7 +100,7 @@ fun foo() {
100100
f.<caret>field;
101101
}
102102
------------------------------------------------------------------------
103-
```
103+
```tact
104104
message Foo
105105
field: Int
106106
```
@@ -119,7 +119,7 @@ fun foo() {
119119
f.<caret>field;
120120
}
121121
------------------------------------------------------------------------
122-
```
122+
```tact
123123
struct Foo
124124
field: Int = 0
125125
```
@@ -137,7 +137,7 @@ fun foo() {
137137
let f = Foo { <caret>field: 10 };
138138
}
139139
------------------------------------------------------------------------
140-
```
140+
```tact
141141
struct Foo
142142
field: Int as uint8
143143
```
@@ -155,7 +155,7 @@ fun foo() {
155155
let f = Foo { <caret>field: 10 };
156156
}
157157
------------------------------------------------------------------------
158-
```
158+
```tact
159159
struct Foo
160160
field: Slice as remaining
161161
```
@@ -173,7 +173,7 @@ fun foo() {
173173
let f = Foo { <caret>field: 10 };
174174
}
175175
------------------------------------------------------------------------
176-
```
176+
```tact
177177
struct Foo
178178
field: map<Int as uint8, Int>
179179
```

server/src/e2e/suite/testcases/documentation/traits.test

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trait <caret>Foo {
77
value: Int;
88
}
99
------------------------------------------------------------------------
10-
```
10+
```tact
1111
trait Foo
1212
```
1313
Some cool trait
@@ -23,7 +23,7 @@ trait <caret>Foo with Other {
2323
value: Int;
2424
}
2525
------------------------------------------------------------------------
26-
```
26+
```tact
2727
trait Foo with Other
2828
```
2929
Some cool trait
@@ -37,7 +37,7 @@ trait Foo {
3737
<caret>field: Int;
3838
}
3939
------------------------------------------------------------------------
40-
```
40+
```tact
4141
trait Foo
4242
field: Int
4343
```

0 commit comments

Comments
 (0)