@@ -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." );
@@ -435,6 +436,41 @@ json::Value toJSON(const Capabilities &C) {
435
436
return result;
436
437
}
437
438
439
+ bool fromJSON (const json::Value &Params, Scope::PresentationHint &PH,
440
+ json::Path P) {
441
+ auto rawHint = Params.getAsString ();
442
+ if (!rawHint) {
443
+ P.report (" expected a string" );
444
+ return false ;
445
+ }
446
+ const std::optional<Scope::PresentationHint> hint =
447
+ StringSwitch<std::optional<Scope::PresentationHint>>(*rawHint)
448
+ .Case (" arguments" , Scope::eScopePresentationHintArguments)
449
+ .Case (" locals" , Scope::eScopePresentationHintLocals)
450
+ .Case (" registers" , Scope::eScopePresentationHintRegisters)
451
+ .Case (" returnValue" , Scope::eScopePresentationHintReturnValue)
452
+ .Default (std::nullopt);
453
+ if (!hint) {
454
+ P.report (" unexpected value" );
455
+ return false ;
456
+ }
457
+ PH = *hint;
458
+ return true ;
459
+ }
460
+
461
+ bool fromJSON (const json::Value &Params, Scope &S, json::Path P) {
462
+ json::ObjectMapper O (Params, P);
463
+ return O && O.map (" name" , S.name ) &&
464
+ O.mapOptional (" presentationHint" , S.presentationHint ) &&
465
+ O.map (" variablesReference" , S.variablesReference ) &&
466
+ O.mapOptional (" namedVariables" , S.namedVariables ) &&
467
+ O.map (" indexedVariables" , S.indexedVariables ) &&
468
+ O.mapOptional (" source" , S.source ) && O.map (" expensive" , S.expensive ) &&
469
+ O.mapOptional (" line" , S.line ) && O.mapOptional (" column" , S.column ) &&
470
+ O.mapOptional (" endLine" , S.endLine ) &&
471
+ O.mapOptional (" endColumn" , S.endColumn );
472
+ }
473
+
438
474
llvm::json::Value toJSON (const Scope &SC) {
439
475
llvm::json::Object result{{" name" , SC.name },
440
476
{" variablesReference" , SC.variablesReference },
@@ -443,16 +479,16 @@ llvm::json::Value toJSON(const Scope &SC) {
443
479
if (SC.presentationHint .has_value ()) {
444
480
llvm::StringRef presentationHint;
445
481
switch (*SC.presentationHint ) {
446
- case Scope::ePresentationHintArguments :
482
+ case Scope::eScopePresentationHintArguments :
447
483
presentationHint = " arguments" ;
448
484
break ;
449
- case Scope::ePresentationHintLocals :
485
+ case Scope::eScopePresentationHintLocals :
450
486
presentationHint = " locals" ;
451
487
break ;
452
- case Scope::ePresentationHintRegisters :
488
+ case Scope::eScopePresentationHintRegisters :
453
489
presentationHint = " registers" ;
454
490
break ;
455
- case Scope::ePresentationHintReturnValue :
491
+ case Scope::eScopePresentationHintReturnValue :
456
492
presentationHint = " returnValue" ;
457
493
break ;
458
494
}
0 commit comments