Skip to content

Commit 94df75d

Browse files
authored
chore: add more logging (#210)
1 parent 166737b commit 94df75d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,6 @@ npm/*/rslint.exe
153153

154154
## vscode settings
155155
.vscode/settings.json
156+
157+
# go cache
158+
packages/rslint/pkg/

cmd/rslint/lsp.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ func (s *LSPServer) Handle(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrp
8282
}
8383

8484
func (s *LSPServer) handleInitialize(ctx context.Context, req *jsonrpc2.Request) (interface{}, error) {
85+
log.Printf("Handling initialize: %+v", req)
8586
// Check if params is nil
8687
if req.Params == nil {
8788
return nil, &jsonrpc2.Error{
@@ -116,6 +117,7 @@ func (s *LSPServer) handleInitialize(ctx context.Context, req *jsonrpc2.Request)
116117
}
117118

118119
func (s *LSPServer) handleDidOpen(ctx context.Context, req *jsonrpc2.Request) {
120+
log.Printf("Handling didOpen: %+v", req)
119121
var params lsproto.DidOpenTextDocumentParams
120122
if err := json.Unmarshal(*req.Params, &params); err != nil {
121123
return
@@ -129,6 +131,7 @@ func (s *LSPServer) handleDidOpen(ctx context.Context, req *jsonrpc2.Request) {
129131
}
130132

131133
func (s *LSPServer) handleDidChange(ctx context.Context, req *jsonrpc2.Request) {
134+
log.Printf("Handling didChange: %+v", req)
132135
var params lsproto.DidChangeTextDocumentParams
133136
if err := json.Unmarshal(*req.Params, &params); err != nil {
134137
return
@@ -145,6 +148,7 @@ func (s *LSPServer) handleDidChange(ctx context.Context, req *jsonrpc2.Request)
145148
}
146149

147150
func (s *LSPServer) handleDidSave(ctx context.Context, req *jsonrpc2.Request) {
151+
log.Printf("Handling didSave: %+v", req)
148152
// Re-run diagnostics on save
149153
var params lsproto.DidSaveTextDocumentParams
150154

@@ -163,6 +167,7 @@ func (s *LSPServer) handleShutdown(ctx context.Context, req *jsonrpc2.Request) (
163167
}
164168

165169
func (s *LSPServer) handleCodeAction(ctx context.Context, req *jsonrpc2.Request) (interface{}, error) {
170+
log.Printf("Handling codeAction: %+v", req)
166171
var params lsproto.CodeActionParams
167172
if err := json.Unmarshal(*req.Params, &params); err != nil {
168173
return nil, &jsonrpc2.Error{
@@ -232,6 +237,7 @@ func (s *LSPServer) handleCodeAction(ctx context.Context, req *jsonrpc2.Request)
232237
}
233238

234239
func (s *LSPServer) runDiagnostics(ctx context.Context, uri lsproto.DocumentUri, content string) {
240+
log.Printf("Running diagnostics for: %+v", uri)
235241
uriString := string(uri)
236242

237243
// Only process TypeScript/JavaScript files

0 commit comments

Comments
 (0)