Skip to content

Commit

Permalink
Fix an undefined access when an edit is done before cpptools starts (#…
Browse files Browse the repository at this point in the history
…13206)

* Fix an undefined access.
  • Loading branch information
sean-mcmanus authored Jan 28, 2025
1 parent 3614cab commit 77f30fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1842,7 +1842,8 @@ export class DefaultClient implements Client {
public onDidChangeTextDocument(textDocumentChangeEvent: vscode.TextDocumentChangeEvent): void {
if (util.isCpp(textDocumentChangeEvent.document)) {
// If any file has changed, we need to abort the current rename operation
if (workspaceReferences.renamePending) {
if (workspaceReferences !== undefined // Occurs when a document changes before cpptools starts.
&& workspaceReferences.renamePending) {
workspaceReferences.cancelCurrentReferenceRequest(refs.CancellationSender.User);
}

Expand Down
2 changes: 1 addition & 1 deletion Extension/src/LanguageServer/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ async function onDidChangeSettings(event: vscode.ConfigurationChangeEvent): Prom
}
}

async function onDidChangeTextDocument(event: vscode.TextDocumentChangeEvent): Promise<void> {
function onDidChangeTextDocument(event: vscode.TextDocumentChangeEvent): void {
const me: Client = clients.getClientFor(event.document.uri);
me.onDidChangeTextDocument(event);
}
Expand Down

0 comments on commit 77f30fa

Please sign in to comment.