@@ -103,7 +103,8 @@ pub struct LanguageFeatures {
103
103
#[ serde( skip_serializing_if = "Option::is_none" ) ]
104
104
signatureHelp : Option < bool > ,
105
105
#[ serde( skip_serializing_if = "Option::is_none" ) ]
106
- completion : Option < Completion > ,
106
+ // completion: Option<Completion>,
107
+ completion : Option < bool > ,
107
108
#[ serde( skip_serializing_if = "Option::is_none" ) ]
108
109
documentHighlight : Option < bool > ,
109
110
#[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -112,23 +113,24 @@ pub struct LanguageFeatures {
112
113
workspaceSymbol : Option < bool > ,
113
114
#[ serde( skip_serializing_if = "Option::is_none" ) ]
114
115
codeLens : Option < CodeLens > ,
116
+ // codeLens: Option<bool>,
115
117
#[ serde( skip_serializing_if = "Option::is_none" ) ]
116
118
semanticTokens : Option < bool > ,
117
119
#[ serde( skip_serializing_if = "Option::is_none" ) ]
118
120
codeAction : Option < bool > ,
119
121
#[ serde( skip_serializing_if = "Option::is_none" ) ]
120
122
inlayHints : Option < bool > ,
123
+ /// 诊断
121
124
#[ serde( skip_serializing_if = "Option::is_none" ) ]
122
125
diagnostics : Option < bool > ,
123
126
#[ serde( skip_serializing_if = "Option::is_none" ) ]
124
- schemaRequestService : Option < SchemaRequestService > ,
127
+ // schemaRequestService: Option<SchemaRequestService>,
128
+ schemaRequestService : Option < bool > ,
125
129
}
126
130
127
131
#[ derive( Debug , PartialEq , Clone , Deserialize , Serialize ) ]
128
132
#[ serde( rename_all = "camelCase" ) ]
129
133
pub struct DocumentFeatures {
130
- #[ serde( skip_serializing_if = "Option::is_none" ) ]
131
- allowedLanguageIds : Option < Vec < String > > ,
132
134
#[ serde( skip_serializing_if = "Option::is_none" ) ]
133
135
selectionRange : Option < bool > ,
134
136
#[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -143,36 +145,6 @@ pub struct DocumentFeatures {
143
145
documentFormatting : Option < bool > ,
144
146
}
145
147
146
- #[ derive( Debug , PartialEq , Clone , Deserialize , Serialize ) ]
147
- #[ serde( rename_all = "camelCase" ) ]
148
- pub struct MainLanguageFeature {
149
- pub references : Option < bool > ,
150
- pub implementation : Option < bool > ,
151
- pub definition : Option < bool > ,
152
- pub typeDefinition : Option < bool > ,
153
- pub callHierarchy : Option < bool > ,
154
- pub hover : Option < bool > ,
155
- pub rename : Option < bool > ,
156
- pub renameFileRefactoring : Option < bool > ,
157
- pub signatureHelp : Option < bool > ,
158
- pub codeAction : Option < bool > ,
159
- pub workspaceSymbol : Option < bool > ,
160
- pub completion : Completion ,
161
- pub schemaRequestService : Option < SchemaRequestService > ,
162
- }
163
-
164
- #[ derive( Debug , PartialEq , Clone , Deserialize , Serialize ) ]
165
- #[ serde( rename_all = "camelCase" ) ]
166
- struct SecondLanguageFeature {
167
- documentHighlight : Option < bool > ,
168
- documentLink : Option < bool > ,
169
- codeLens : Option < CodeLens > ,
170
- semanticTokens : Option < bool > ,
171
- inlayHints : Option < bool > ,
172
- diagnostics : Option < bool > ,
173
- schemaRequestService : Option < SchemaRequestService > ,
174
- }
175
-
176
148
#[ derive( Debug , PartialEq , Clone , Deserialize , Serialize ) ]
177
149
#[ serde( rename_all = "camelCase" ) ]
178
150
struct ServerInitializationOptions {
@@ -185,44 +157,50 @@ struct ServerInitializationOptions {
185
157
}
186
158
pub fn get_main_language_feature ( ) -> LanguageFeatures {
187
159
LanguageFeatures {
188
- references : None ,
160
+ references : Some ( true ) ,
189
161
// 不存在
190
- implementation : None ,
191
- definition : None ,
192
- typeDefinition : None ,
193
- callHierarchy : None ,
162
+ implementation : Some ( true ) ,
163
+ definition : Some ( true ) ,
164
+ typeDefinition : Some ( true ) ,
165
+ callHierarchy : Some ( true ) ,
194
166
hover : None ,
195
- rename : None ,
196
- renameFileRefactoring : None ,
197
- signatureHelp : None ,
198
- codeAction : None ,
199
- workspaceSymbol : None ,
200
- completion : Some ( Completion {
201
- defaultTagNameCase : DefaultTagNameCase :: both,
202
- defaultAttrNameCase : DefaultAttrNameCase :: kebabCase,
203
- getDocumentNameCasesRequest : Some ( false ) ,
204
- getDocumentSelectionRequest : Some ( false ) ,
205
- ignoreTriggerCharacters : None ,
167
+ rename : Some ( true ) ,
168
+ renameFileRefactoring : Some ( true ) ,
169
+ signatureHelp : Some ( true ) ,
170
+ codeAction : Some ( true ) ,
171
+ workspaceSymbol : Some ( true ) ,
172
+ // completion: Some(Completion {
173
+ // defaultTagNameCase: DefaultTagNameCase::both,
174
+ // defaultAttrNameCase: DefaultAttrNameCase::kebabCase,
175
+ // getDocumentNameCasesRequest: Some(true),
176
+ // getDocumentSelectionRequest: Some(true),
177
+ // ignoreTriggerCharacters: None,
178
+ // }),
179
+ completion : Some ( true ) ,
180
+ schemaRequestService : Some ( true ) ,
181
+ documentHighlight : Some ( true ) ,
182
+ documentLink : Some ( true ) ,
183
+ codeLens : Some ( CodeLens {
184
+ showReferencesNotification : Some ( true ) ,
206
185
} ) ,
207
- schemaRequestService : None ,
208
- documentHighlight : None ,
209
- documentLink : None ,
210
- codeLens : None ,
211
- semanticTokens : None ,
212
- inlayHints : None ,
213
- diagnostics : None ,
186
+ // 语义标记
187
+ semanticTokens : Some ( false ) ,
188
+ inlayHints : Some ( true ) ,
189
+ diagnostics : Some ( true ) ,
214
190
}
215
191
}
216
192
217
193
pub fn get_second_language_feature ( ) -> LanguageFeatures {
218
194
LanguageFeatures {
219
- documentHighlight : None ,
220
- documentLink : None ,
221
- codeLens : None ,
222
- semanticTokens : None ,
195
+ documentHighlight : Some ( true ) ,
196
+ documentLink : Some ( true ) ,
197
+ codeLens : Some ( CodeLens {
198
+ showReferencesNotification : Some ( true ) ,
199
+ } ) ,
200
+ semanticTokens : Some ( true ) ,
223
201
// 不存在
224
- inlayHints : None ,
225
- diagnostics : None ,
202
+ inlayHints : Some ( true ) ,
203
+ diagnostics : Some ( true ) ,
226
204
schemaRequestService : None ,
227
205
references : None ,
228
206
implementation : None ,
@@ -241,21 +219,27 @@ pub fn get_second_language_feature() -> LanguageFeatures {
241
219
242
220
pub fn get_doc_feature ( ) -> DocumentFeatures {
243
221
DocumentFeatures {
244
- // allowedLanguageIds: vec![
222
+ // allowedLanguageIds: Some( vec![
245
223
// "vue".to_owned(),
246
224
// "javascript".to_owned(),
247
225
// "typescript".to_owned(),
248
226
// "javascriptreact".to_owned(),
249
227
// "typescriptreact".to_owned(),
250
- // ],
251
- allowedLanguageIds : None ,
252
- selectionRange : None ,
253
- foldingRange : None ,
254
- linkedEditingRange : None ,
255
- documentSymbol : None ,
256
- documentColor : None ,
257
- // 没有格式胡
258
- documentFormatting : None ,
228
+ // ]),
229
+ // allowedLanguageIds: Some(),
230
+ // selectionRange: Some(true),
231
+ // foldingRange: Some(true),
232
+ // linkedEditingRange: Some(true),
233
+ // documentSymbol: Some(true),
234
+ // documentColor: Some(true),
235
+ // // 没有格式胡
236
+ // documentFormatting: Some(true),
237
+ selectionRange : Some ( true ) ,
238
+ foldingRange : Some ( true ) ,
239
+ linkedEditingRange : Some ( true ) ,
240
+ documentSymbol : Some ( true ) ,
241
+ documentColor : Some ( true ) ,
242
+ documentFormatting : Some ( true ) ,
259
243
}
260
244
}
261
245
@@ -280,15 +264,19 @@ pub fn get_initialization_options(name: LanguageOptionEnum) -> Option<Value> {
280
264
let initialization_options = ServerInitializationOptions {
281
265
// textDocumentSync: TextDocumentSyncKind::Incremental,
282
266
typescript : TypescriptPath {
283
- // serverPath: "/Users/skymac/node_modules/typescript/lib/tsserverlibrary.js".to_owned(),
284
- serverPath : "/Users/xiaoxin/Library/pnpm/global/5/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserverlibrary.js" . to_owned ( ) ,
267
+ serverPath :
268
+ "/Users/skymac/Library/pnpm/global/5/.pnpm/typescript@4.8.4/node_modules/typescript/lib/tsserverlibrary.js"
269
+ . to_owned ( ) ,
270
+ // serverPath: "/Users/xiaoxin/Library/pnpm/global/5/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserverlibrary.js".to_owned(),
285
271
localizedPath : None , // localizedPath: Some(
286
272
// "/Users/skymac/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json"
287
273
// .to_owned(),
288
274
// ),
289
275
} ,
290
- languageFeatures : language_features ,
291
- documentFeatures : document_features ,
276
+ languageFeatures : Some ( get_main_language_feature ( ) ) ,
277
+ documentFeatures : Some ( get_doc_feature ( ) ) ,
292
278
} ;
293
279
serde_json:: to_value ( & initialization_options) . ok ( )
294
280
}
281
+
282
+ fn find_volar_path ( root_path : Option < String > ) { }
0 commit comments