Skip to content

Commit

Permalink
Merge pull request #286 from onflow/jribbink/ls-diagnostic-update
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent authored Feb 22, 2024
2 parents 96e46d6 + bf24ee7 commit 3681b8d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions languageserver/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3273,7 +3273,11 @@ func convertDiagnostic(
}
severity = protocol.SeverityHint
tags = append(tags, protocol.Deprecated)
case linter.CadenceV1Category:
severity = protocol.SeverityError
}

if codeActionsResolver == nil && len(linterDiagnostic.SuggestedFixes) > 0 {
codeActionsResolver = func() []*protocol.CodeAction {
return conversion.SuggestedFixesToCodeActions(
linterDiagnostic.SuggestedFixes,
Expand All @@ -3294,5 +3298,15 @@ func convertDiagnostic(
Tags: tags,
}

if linterDiagnostic.Code != "" {
protocolDiagnostic.Code = linterDiagnostic.Code

if linterDiagnostic.URL != "" {
protocolDiagnostic.CodeDescription = &protocol.CodeDescription{
Href: linterDiagnostic.URL,
}
}
}

return protocolDiagnostic, codeActionsResolver
}

0 comments on commit 3681b8d

Please sign in to comment.