Skip to content

Commit d3d0e34

Browse files
committed
Added nightly build schedule
1 parent 50e97c4 commit d3d0e34

File tree

3 files changed

+55
-4
lines changed

3 files changed

+55
-4
lines changed

Diff for: azure-pipelines.yml

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ trigger:
44
include:
55
- master
66

7+
schedules:
8+
- cron: "0 4 * * Mon-Fri"
9+
displayName: Nightly Build
10+
branches:
11+
include:
12+
- master
13+
714
pr:
815
- master
916

Diff for: handler/handler.go

+26-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (handler *InoHandler) FromStdio(ctx context.Context, conn *jsonrpc2.Conn, r
6868
result, err = sendRequest(ctx, handler.ClangdConn, req.Method, params)
6969
}
7070
if err != nil {
71-
log.Println("From stdio: Method:", req.Method, "Params:", params, "Error:", err)
71+
log.Println("From stdio: Method:", req.Method, "Error:", err)
7272
return nil, err
7373
}
7474
if enableLogging {
@@ -130,6 +130,14 @@ func (handler *InoHandler) transformClangdParams(method string, raw *json.RawMes
130130
p := params.(*lsp.ReferenceParams)
131131
uri = p.TextDocument.URI
132132
err = handler.ino2cppTextDocumentPositionParams(&p.TextDocumentPositionParams)
133+
case "textDocument/formatting":
134+
p := params.(*lsp.DocumentFormattingParams)
135+
uri = p.TextDocument.URI
136+
err = handler.ino2cppTextDocumentIdentifier(&p.TextDocument)
137+
case "textDocument/rangeFormatting":
138+
// TODO
139+
case "textDocument/onTypeFormatting":
140+
// TODO
133141
}
134142
return
135143
}
@@ -286,6 +294,15 @@ func (handler *InoHandler) transformClangdResult(method string, uri lsp.Document
286294
for index := range *r {
287295
handler.cpp2inoDocumentHighlight(&(*r)[index], uri)
288296
}
297+
case "textDocument/formatting":
298+
fallthrough
299+
case "textDocument/rangeFormatting":
300+
fallthrough
301+
case "textDocument/onTypeFormatting":
302+
r := result.(*[]lsp.TextEdit)
303+
for index := range *r {
304+
handler.cpp2inoTextEdit(&(*r)[index], uri)
305+
}
289306
}
290307
return result
291308
}
@@ -357,6 +374,13 @@ func (handler *InoHandler) cpp2inoDocumentHighlight(highlight *lsp.DocumentHighl
357374
}
358375
}
359376

377+
func (handler *InoHandler) cpp2inoTextEdit(edit *lsp.TextEdit, uri lsp.DocumentURI) {
378+
if data, ok := handler.data[uri]; ok {
379+
edit.Range.Start.Line = data.sourceLineMap[edit.Range.Start.Line]
380+
edit.Range.End.Line = data.sourceLineMap[edit.Range.End.Line]
381+
}
382+
}
383+
360384
// FromClangd handles a message received from clangd.
361385
func (handler *InoHandler) FromClangd(ctx context.Context, connection *jsonrpc2.Conn, req *jsonrpc2.Request) (interface{}, error) {
362386
params, _, err := handler.transformStdioParams(req.Method, req.Params)
@@ -371,7 +395,7 @@ func (handler *InoHandler) FromClangd(ctx context.Context, connection *jsonrpc2.
371395
result, err = sendRequest(ctx, handler.StdioConn, req.Method, params)
372396
}
373397
if err != nil {
374-
log.Println("From clangd: Method:", req.Method, "Params:", params, "Error:", err)
398+
log.Println("From clangd: Method:", req.Method, "Error:", err)
375399
return nil, err
376400
}
377401
if enableLogging {

Diff for: handler/protocol.go

+22-2
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,24 @@ func readParams(method string, raw *json.RawMessage) (interface{}, error) {
4242
fallthrough
4343
case "textDocument/implementation":
4444
fallthrough
45+
case "textDocument/references":
46+
params := new(lsp.ReferenceParams)
47+
err := json.Unmarshal(*raw, params)
48+
return params, err
4549
case "textDocument/documentHighlight":
4650
params := new(lsp.TextDocumentPositionParams)
4751
err := json.Unmarshal(*raw, params)
4852
return params, err
49-
case "textDocument/references":
50-
params := new(lsp.ReferenceParams)
53+
case "textDocument/formatting":
54+
params := new(lsp.DocumentFormattingParams)
55+
err := json.Unmarshal(*raw, params)
56+
return params, err
57+
case "textDocument/rangeFormatting":
58+
params := new(lsp.DocumentRangeFormattingParams)
59+
err := json.Unmarshal(*raw, params)
60+
return params, err
61+
case "textDocument/onTypeFormatting":
62+
params := new(lsp.DocumentOnTypeFormattingParams)
5163
err := json.Unmarshal(*raw, params)
5264
return params, err
5365
case "textDocument/publishDiagnostics":
@@ -94,6 +106,14 @@ func sendRequest(ctx context.Context, conn *jsonrpc2.Conn, method string, params
94106
result := new([]lsp.DocumentHighlight)
95107
err := conn.Call(ctx, method, params, result)
96108
return result, err
109+
case "textDocument/formatting":
110+
fallthrough
111+
case "textDocument/rangeFormatting":
112+
fallthrough
113+
case "textDocument/onTypeFormatting":
114+
result := new([]lsp.TextEdit)
115+
err := conn.Call(ctx, method, params, result)
116+
return result, err
97117
case "window/showMessageRequest":
98118
result := new(lsp.MessageActionItem)
99119
err := conn.Call(ctx, method, params, result)

0 commit comments

Comments
 (0)