Skip to content

Commit ceb1c21

Browse files
committed
Fixed TextDocumentSignatureHelpReqFromIDE
1 parent 5189b8b commit ceb1c21

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

Diff for: ls/ls.go

+15-16
Original file line numberDiff line numberDiff line change
@@ -443,40 +443,39 @@ func (ls *INOLanguageServer) TextDocumentHoverReqFromIDE(ctx context.Context, lo
443443
return &ideResp, nil
444444
}
445445

446-
func (ls *INOLanguageServer) clangURIRefersToIno(uri lsp.DocumentURI) bool {
447-
return uri.AsPath().EquivalentTo(ls.buildSketchCpp)
446+
func (ls *INOLanguageServer) clangURIRefersToIno(clangURI lsp.DocumentURI) bool {
447+
return clangURI.AsPath().EquivalentTo(ls.buildSketchCpp)
448448
}
449449

450-
func (ls *INOLanguageServer) TextDocumentSignatureHelpReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, inoParams *lsp.SignatureHelpParams) (*lsp.SignatureHelp, *jsonrpc.ResponseError) {
450+
func (ls *INOLanguageServer) TextDocumentSignatureHelpReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.SignatureHelpParams) (*lsp.SignatureHelp, *jsonrpc.ResponseError) {
451451
ls.readLock(logger, true)
452452
defer ls.readUnlock(logger)
453453

454-
inoTextDocumentPosition := inoParams.TextDocumentPositionParams
455-
456-
logger.Logf("%s", inoTextDocumentPosition)
457-
cppTextDocumentPosition, err := ls.ide2ClangTextDocumentPositionParams(logger, inoTextDocumentPosition)
454+
clangTextDocumentPosition, err := ls.ide2ClangTextDocumentPositionParams(logger, ideParams.TextDocumentPositionParams)
458455
if err != nil {
459456
logger.Logf("Error: %s", err)
460457
return nil, &jsonrpc.ResponseError{Code: jsonrpc.ErrorCodesInternalError, Message: err.Error()}
461458
}
462459

463-
logger.Logf("-> %s", cppTextDocumentPosition)
464-
cppParams := *inoParams
465-
cppParams.TextDocumentPositionParams = cppTextDocumentPosition
466-
cppSignatureHelp, cppErr, err := ls.Clangd.conn.TextDocumentSignatureHelp(ctx, inoParams)
460+
clangParams := &lsp.SignatureHelpParams{
461+
TextDocumentPositionParams: clangTextDocumentPosition,
462+
WorkDoneProgressParams: ideParams.WorkDoneProgressParams,
463+
Context: ideParams.Context,
464+
}
465+
clangSignatureHelp, clangErr, err := ls.Clangd.conn.TextDocumentSignatureHelp(ctx, clangParams)
467466
if err != nil {
468467
logger.Logf("clangd communication error: %v", err)
469468
ls.Close()
470469
return nil, &jsonrpc.ResponseError{Code: jsonrpc.ErrorCodesInternalError, Message: err.Error()}
471470
}
472-
if cppErr != nil {
473-
logger.Logf("clangd response error: %v", cppErr.AsError())
474-
return nil, &jsonrpc.ResponseError{Code: jsonrpc.ErrorCodesInternalError, Message: cppErr.AsError().Error()}
471+
if clangErr != nil {
472+
logger.Logf("clangd response error: %v", clangErr.AsError())
473+
return nil, &jsonrpc.ResponseError{Code: jsonrpc.ErrorCodesInternalError, Message: clangErr.AsError().Error()}
475474
}
476475

477476
// No need to convert back to inoSignatureHelp
478-
479-
return cppSignatureHelp, nil
477+
ideSignatureHelp := clangSignatureHelp
478+
return ideSignatureHelp, nil
480479
}
481480

482481
func (ls *INOLanguageServer) TextDocumentDefinitionReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.DefinitionParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError) {

0 commit comments

Comments
 (0)