File tree 1 file changed +17
-8
lines changed
1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -485,6 +485,16 @@ func (l *LanguageServer) StartCommandWorker(ctx context.Context) {
485
485
if err != nil {
486
486
fmt .Fprintf (os .Stderr , "failed to evaluate workspace path: %v\n " , err )
487
487
488
+ err := l .conn .Notify (ctx , "window/showMessage" , types.ShowMessageParams {
489
+ Type : 1 , // error
490
+ Message : err .Error (),
491
+ })
492
+ if err != nil {
493
+ l .logError (fmt .Errorf ("failed to notify client of eval error: %w" , err ))
494
+
495
+ break
496
+ }
497
+
488
498
break
489
499
}
490
500
@@ -1079,17 +1089,16 @@ func (l *LanguageServer) handleTextDocumentCodeLens(
1079
1089
}
1080
1090
1081
1091
func getRuleName (rule * ast.Rule ) string {
1082
- parts := make ([]string , 0 , len (rule .Head .Ref ()))
1083
-
1084
- for i , part := range rule .Head .Ref () {
1085
- if ! part .Value .IsGround () && i > 0 {
1086
- break
1087
- }
1092
+ result := rule .Head .Ref ().String ()
1088
1093
1089
- parts = append (parts , part .Value .String ())
1094
+ // only evaluate the top level rule name if there are refs
1095
+ // e.g. my[foo].bar -> my
1096
+ // bar.bar.bar -> bar.bar.bar
1097
+ if i := strings .Index (result , "[" ); i > 0 {
1098
+ return result [:i ]
1090
1099
}
1091
1100
1092
- return strings . Join ( parts , "." )
1101
+ return result
1093
1102
}
1094
1103
1095
1104
func (l * LanguageServer ) handleTextDocumentCompletion (
You can’t perform that action at this time.
0 commit comments