@@ -25,9 +25,9 @@ bool fromJSON(const json::Value &Params, Source::PresentationHint &PH,
25
25
}
26
26
std::optional<Source::PresentationHint> hint =
27
27
StringSwitch<std::optional<Source::PresentationHint>>(*rawHint)
28
- .Case (" normal" , Source::ePresentationHintNormal )
29
- .Case (" emphasize" , Source::ePresentationHintEmphasize )
30
- .Case (" deemphasize" , Source::ePresentationHintDeemphasize )
28
+ .Case (" normal" , Source::eSourcePresentationHintNormal )
29
+ .Case (" emphasize" , Source::eSourcePresentationHintEmphasize )
30
+ .Case (" deemphasize" , Source::eSourcePresentationHintDeemphasize )
31
31
.Default (std::nullopt);
32
32
if (!hint) {
33
33
P.report (" unexpected value" );
@@ -43,13 +43,14 @@ bool fromJSON(const json::Value &Params, Source &S, json::Path P) {
43
43
O.map (" presentationHint" , S.presentationHint ) &&
44
44
O.map (" sourceReference" , S.sourceReference );
45
45
}
46
+
46
47
llvm::json::Value toJSON (Source::PresentationHint hint) {
47
48
switch (hint) {
48
- case Source::ePresentationHintNormal :
49
+ case Source::eSourcePresentationHintNormal :
49
50
return " normal" ;
50
- case Source::ePresentationHintEmphasize :
51
+ case Source::eSourcePresentationHintEmphasize :
51
52
return " emphasize" ;
52
- case Source::ePresentationHintDeemphasize :
53
+ case Source::eSourcePresentationHintDeemphasize :
53
54
return " deemphasize" ;
54
55
}
55
56
llvm_unreachable (" unhandled presentation hint." );
@@ -331,6 +332,41 @@ json::Value toJSON(const Capabilities &C) {
331
332
return result;
332
333
}
333
334
335
+ bool fromJSON (const json::Value &Params, Scope::PresentationHint &PH,
336
+ json::Path P) {
337
+ auto rawHint = Params.getAsString ();
338
+ if (!rawHint) {
339
+ P.report (" expected a string" );
340
+ return false ;
341
+ }
342
+ const std::optional<Scope::PresentationHint> hint =
343
+ StringSwitch<std::optional<Scope::PresentationHint>>(*rawHint)
344
+ .Case (" arguments" , Scope::eScopePresentationHintArguments)
345
+ .Case (" locals" , Scope::eScopePresentationHintLocals)
346
+ .Case (" registers" , Scope::eScopePresentationHintRegisters)
347
+ .Case (" returnValue" , Scope::eScopePresentationHintReturnValue)
348
+ .Default (std::nullopt);
349
+ if (!hint) {
350
+ P.report (" unexpected value" );
351
+ return false ;
352
+ }
353
+ PH = *hint;
354
+ return true ;
355
+ }
356
+
357
+ bool fromJSON (const json::Value &Params, Scope &S, json::Path P) {
358
+ json::ObjectMapper O (Params, P);
359
+ return O && O.map (" name" , S.name ) &&
360
+ O.mapOptional (" presentationHint" , S.presentationHint ) &&
361
+ O.map (" variablesReference" , S.variablesReference ) &&
362
+ O.mapOptional (" namedVariables" , S.namedVariables ) &&
363
+ O.map (" indexedVariables" , S.indexedVariables ) &&
364
+ O.mapOptional (" source" , S.source ) && O.map (" expensive" , S.expensive ) &&
365
+ O.mapOptional (" line" , S.line ) && O.mapOptional (" column" , S.column ) &&
366
+ O.mapOptional (" endLine" , S.endLine ) &&
367
+ O.mapOptional (" endColumn" , S.endColumn );
368
+ }
369
+
334
370
llvm::json::Value toJSON (const Scope &SC) {
335
371
llvm::json::Object result{{" name" , SC.name },
336
372
{" variablesReference" , SC.variablesReference },
@@ -339,16 +375,16 @@ llvm::json::Value toJSON(const Scope &SC) {
339
375
if (SC.presentationHint .has_value ()) {
340
376
llvm::StringRef presentationHint;
341
377
switch (*SC.presentationHint ) {
342
- case Scope::ePresentationHintArguments :
378
+ case Scope::eScopePresentationHintArguments :
343
379
presentationHint = " arguments" ;
344
380
break ;
345
- case Scope::ePresentationHintLocals :
381
+ case Scope::eScopePresentationHintLocals :
346
382
presentationHint = " locals" ;
347
383
break ;
348
- case Scope::ePresentationHintRegisters :
384
+ case Scope::eScopePresentationHintRegisters :
349
385
presentationHint = " registers" ;
350
386
break ;
351
- case Scope::ePresentationHintReturnValue :
387
+ case Scope::eScopePresentationHintReturnValue :
352
388
presentationHint = " returnValue" ;
353
389
break ;
354
390
}
0 commit comments