Skip to content

Commit

Permalink
[mod] add Shutdown handler
Browse files Browse the repository at this point in the history
  • Loading branch information
dohq committed Dec 24, 2019
1 parent f6356b6 commit d8f904a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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 d8f904a

Please sign in to comment.