File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import org.eclipse.lsp4j.TextDocumentContentChangeEvent
3333import org.eclipse.lsp4j.TextDocumentIdentifier
3434import org.eclipse.lsp4j.TextDocumentItem
3535import org.eclipse.lsp4j.VersionedTextDocumentIdentifier
36+ import software.aws.toolkits.core.utils.tryOrNull
3637import software.aws.toolkits.jetbrains.services.amazonq.lsp.AmazonQLspService
3738import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.ACTIVE_EDITOR_CHANGED_NOTIFICATION
3839import software.aws.toolkits.jetbrains.services.amazonq.lsp.util.LspEditorUtil.getCursorState
@@ -91,7 +92,7 @@ class TextDocumentServiceHandler(
9192 ApplicationManager .getApplication().runReadAction {
9293 val existingListener = file.getUserData(KEY_REAL_TIME_EDIT_LISTENER )
9394 if (existingListener != null ) {
94- FileDocumentManager .getInstance().getDocument(file)?.removeDocumentListener(existingListener)
95+ tryOrNull { FileDocumentManager .getInstance().getDocument(file)?.removeDocumentListener(existingListener) }
9596 file.putUserData(KEY_REAL_TIME_EDIT_LISTENER , null )
9697 }
9798 }
@@ -175,7 +176,7 @@ class TextDocumentServiceHandler(
175176 ) {
176177 val listener = file.getUserData(KEY_REAL_TIME_EDIT_LISTENER )
177178 if (listener != null ) {
178- FileDocumentManager .getInstance().getDocument(file)?.removeDocumentListener(listener)
179+ tryOrNull { FileDocumentManager .getInstance().getDocument(file)?.removeDocumentListener(listener) }
179180 file.putUserData(KEY_REAL_TIME_EDIT_LISTENER , null )
180181
181182 cs.launch {
You can’t perform that action at this time.
0 commit comments