Skip to content

Commit 88d1ceb

Browse files
authored
Merge pull request #3 from nametake/same-file-name-error
Fixed not to output Issue with the same file name in different directories
2 parents 0ee3aa9 + c4f5af6 commit 88d1ceb

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

handler.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (h *langHandler) lint(uri DocumentURI) ([]Diagnostic, error) {
5050
for _, issue := range result.Issues {
5151
issue := issue
5252

53-
if !strings.HasSuffix(string(uri), issue.Pos.Filename) {
53+
if strings.TrimPrefix(string(uri), h.rootURI+"/") != issue.Pos.Filename {
5454
continue
5555
}
5656

@@ -80,6 +80,7 @@ func (h *langHandler) linter() {
8080
diagnostics, err := h.lint(uri)
8181
if err != nil {
8282
h.logger.Printf("%s", err)
83+
8384
continue
8485
}
8586

@@ -137,6 +138,7 @@ func (h *langHandler) handleInitialize(_ context.Context, conn *jsonrpc2.Conn, r
137138

138139
func (h *langHandler) handleShutdown(_ context.Context, _ *jsonrpc2.Conn, _ *jsonrpc2.Request) (result interface{}, err error) {
139140
close(h.request)
141+
140142
return nil, nil
141143
}
142144

logger.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import (
66
"os"
77
)
88

9-
var (
10-
_ logger = (*stdLogger)(nil)
11-
)
9+
var _ logger = (*stdLogger)(nil)
1210

1311
type logger interface {
1412
Printf(format string, args ...interface{})

main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import (
99
)
1010

1111
func main() {
12-
var (
13-
debug = flag.Bool("debug", false, "show debug log")
14-
)
12+
debug := flag.Bool("debug", false, "show debug log")
1513

1614
flag.Parse()
1715

@@ -47,5 +45,6 @@ func (stdrwc) Close() error {
4745
if err := os.Stdin.Close(); err != nil {
4846
return err
4947
}
48+
5049
return os.Stdout.Close()
5150
}

0 commit comments

Comments
 (0)