@@ -137,16 +137,16 @@ func findRange(issue ossIssue, doc sglsp.TextDocumentItem) sglsp.Range {
137137 lines := strings .Split (
138138 strings .ReplaceAll (doc .Text , "\r " , "" ),
139139 "\n " )
140+ var packageName string
141+ if len (issue .From ) > 1 {
142+ split := strings .Split (issue .From [1 ], "@" )
143+ packageName = fmt .Sprintf ("\" %s\" : \" " , split [0 ])
144+ } else {
145+ packageName = fmt .Sprintf ("\" %s\" : \" " , issue .Name )
146+ }
140147 var lineStart , lineEnd , characterStart , characterEnd int
141148 for i := 0 ; i < len (lines ); i ++ {
142149 line := lines [i ]
143- var packageName string
144- if len (issue .From ) > 1 {
145- split := strings .Split (issue .From [1 ], "@" )
146- packageName = fmt .Sprintf ("\" %s\" : \" " , split [0 ])
147- } else {
148- packageName = fmt .Sprintf ("\" %s\" : \" " , issue .Name )
149- }
150150 if issue .PackageManager == "npm" {
151151 if strings .HasPrefix (
152152 strings .TrimSpace (strings .ReplaceAll (line , "^" , "" )), packageName ) {
@@ -157,7 +157,7 @@ func findRange(issue ossIssue, doc sglsp.TextDocumentItem) sglsp.Range {
157157 break
158158 } else if issue .PackageManager == "maven" {
159159 // todo respect from
160- packageName = strings .Split (strings .ReplaceAll (packageName , "\" " , "" ), ":" )[0 ]
160+ packageName = strings .Split (strings .ReplaceAll (packageName , "\" " , "" ), ":" )[1 ]
161161 if filepath .Base (string (doc .URI )) == "pom.xml" &&
162162 strings .Contains (
163163 line , fmt .Sprintf ("<artifactId>%s</artifactId>" , packageName ),
0 commit comments