File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -91,8 +91,14 @@ func (h *langHandler) lint(uri DocumentURI) ([]Diagnostic, error) {
91
91
92
92
d := Diagnostic {
93
93
Range : Range {
94
- Start : Position {Line : issue .Pos .Line - 1 , Character : issue .Pos .Column - 1 },
95
- End : Position {Line : issue .Pos .Line - 1 , Character : issue .Pos .Column - 1 },
94
+ Start : Position {
95
+ Line : max (issue .Pos .Line - 1 , 0 ),
96
+ Character : max (issue .Pos .Column - 1 , 0 ),
97
+ },
98
+ End : Position {
99
+ Line : max (issue .Pos .Line - 1 , 0 ),
100
+ Character : max (issue .Pos .Column - 1 , 0 ),
101
+ },
96
102
},
97
103
Severity : issue .DiagSeverity (),
98
104
Source : & issue .FromLinter ,
@@ -104,6 +110,13 @@ func (h *langHandler) lint(uri DocumentURI) ([]Diagnostic, error) {
104
110
return diagnostics , nil
105
111
}
106
112
113
+ func max (a , b int ) int {
114
+ if a > b {
115
+ return a
116
+ }
117
+ return b
118
+ }
119
+
107
120
func (h * langHandler ) diagnosticMessage (issue * Issue ) string {
108
121
if h .noLinterName {
109
122
return issue .Text
You can’t perform that action at this time.
0 commit comments