Skip to content

Commit 6847aa5

Browse files
committed
Ensure write-lock for text-format
1 parent b5031d3 commit 6847aa5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: ls/ls.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,8 @@ func (ls *INOLanguageServer) TextDocumentCodeActionReqFromIDE(ctx context.Contex
845845
}
846846

847847
func (ls *INOLanguageServer) TextDocumentFormattingReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.DocumentFormattingParams) ([]lsp.TextEdit, *jsonrpc.ResponseError) {
848-
ls.readLock(logger, true)
849-
defer ls.readUnlock(logger)
848+
ls.writeLock(logger, true)
849+
defer ls.writeUnlock(logger)
850850

851851
ideTextDocument := ideParams.TextDocument
852852
ideURI := ideTextDocument.URI
@@ -900,8 +900,8 @@ func (ls *INOLanguageServer) TextDocumentFormattingReqFromIDE(ctx context.Contex
900900
}
901901

902902
func (ls *INOLanguageServer) TextDocumentRangeFormattingReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.DocumentRangeFormattingParams) ([]lsp.TextEdit, *jsonrpc.ResponseError) {
903-
ls.readLock(logger, true)
904-
defer ls.readUnlock(logger)
903+
ls.writeLock(logger, true)
904+
defer ls.writeUnlock(logger)
905905

906906
ideURI := ideParams.TextDocument.URI
907907
clangURI, clangRange, err := ls.ide2ClangRange(logger, ideURI, ideParams.Range)

0 commit comments

Comments
 (0)