-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
extending-language-services-folding-provider-example.html
119 lines (99 loc) · 2.65 KB
/
extending-language-services-folding-provider-example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<!-- THIS IS A GENERATED FILE VIA gulp generate-test-samples -->
<html>
<head>
<base href="..">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<style>
/*----------------------------------------SAMPLE CSS START*/
/*----------------------------------------SAMPLE CSS END*/
</style>
<a class="loading-opts" href="playground.generated/index.html">[<< BACK]</a> <br/>
THIS IS A GENERATED FILE VIA gulp generate-test-samples
<div id="bar" style="margin-bottom: 6px;"></div>
<div style="clear:both"></div>
<div id="outer-container" style="width:800px;height:450px;border: 1px solid grey">
<!-- ----------------------------------------SAMPLE HTML START-->
<div id="container" style="height:100%;"></div>
<!-- ----------------------------------------SAMPLE HTML END-->
</div>
<div style="clear:both"></div>
<script src="../metadata.js"></script>
<script src="dev-setup.js"></script>
<script>
loadEditor(function() {
/*----------------------------------------SAMPLE JS START*/
monaco.languages.register({
id: "foldLanguage"
});
var value =
`1. Hit F1 to bring up the Command Palette
2. Type 'fold'
3. Choose 'Fold All Block Comments' or 'Fold All Regions'
5. comment1
6. comment1
7. comment1
9. unfoldable text
10. unfoldable text
11. unfoldable text
13. comment2
14. comment2
15. comment2
16. comment2
17. comment2
19. foldable text
20. foldable text
21. foldable text
23. region1
24. region1
25. region1
27. region2
28. region2
29. region2`
monaco.editor.create(document.getElementById("container"), {
value: value,
language: "foldLanguage"
});
monaco.languages.registerFoldingRangeProvider("foldLanguage", {
provideFoldingRanges: function(model, context, token) {
return [
// comment1
{
start: 5,
end: 7,
kind: monaco.languages.FoldingRangeKind.Comment
},
// comment2
{
start: 13,
end: 17,
kind: monaco.languages.FoldingRangeKind.Comment
},
// foldable text
{
start: 19,
end: 21
},
// region1
{
start: 23,
end: 25,
kind: monaco.languages.FoldingRangeKind.Region
},
// region2
{
start: 27,
end: 29,
kind: monaco.languages.FoldingRangeKind.Region
}
];
}
});
/*----------------------------------------SAMPLE JS END*/
});
</script>
</body>
</html>