Skip to content

Commit

Permalink
Merge pull request #46 from dohq/feat/add-shutdown
Browse files Browse the repository at this point in the history
Feat/add shutdown
  • Loading branch information
juliosueiras committed Feb 14, 2020
2 parents 5ce1b76 + 01cf586 commit 2c6a29f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
10 changes: 8 additions & 2 deletions langserver/exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ package langserver

import (
"context"
lsp "github.com/sourcegraph/go-lsp"
"os"

lsp "github.com/sourcegraph/go-lsp"
)

func Exit(ctx context.Context, vs lsp.None) error {
os.Remove(tempFile.Name())
err := os.Remove(tempFile.Name())
if err != nil {
return err
}

os.Exit(0)
return nil
}
1 change: 1 addition & 0 deletions langserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func CreateServer() *jrpc2.Server {
//"textDocument/references": handler.New(TextDocumentReferences),
//"textDocument/codeLens": handler.New(TextDocumentCodeLens),
"exit": handler.New(Exit),
"shutdown": handler.New(Shutdown),
"$/cancelRequest": handler.New(CancelRequest),
}, &jrpc2.ServerOptions{
AllowPush: true,
Expand Down
17 changes: 17 additions & 0 deletions langserver/shutdown.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package langserver

import (
"context"
"os"

lsp "github.com/sourcegraph/go-lsp"
)

func Shutdown(ctx context.Context, vs lsp.None) error {
err := os.Remove(tempFile.Name())
if err != nil {
return err
}

return nil
}

0 comments on commit 2c6a29f

Please # to comment.