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
33
33
import org.eclipse.lsp4j.TextDocumentIdentifier
34
34
import org.eclipse.lsp4j.TextDocumentItem
35
35
import org.eclipse.lsp4j.VersionedTextDocumentIdentifier
36
+ import software.aws.toolkits.core.utils.tryOrNull
36
37
import software.aws.toolkits.jetbrains.services.amazonq.lsp.AmazonQLspService
37
38
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.ACTIVE_EDITOR_CHANGED_NOTIFICATION
38
39
import software.aws.toolkits.jetbrains.services.amazonq.lsp.util.LspEditorUtil.getCursorState
@@ -91,7 +92,7 @@ class TextDocumentServiceHandler(
91
92
ApplicationManager .getApplication().runReadAction {
92
93
val existingListener = file.getUserData(KEY_REAL_TIME_EDIT_LISTENER )
93
94
if (existingListener != null ) {
94
- FileDocumentManager .getInstance().getDocument(file)?.removeDocumentListener(existingListener)
95
+ tryOrNull { FileDocumentManager .getInstance().getDocument(file)?.removeDocumentListener(existingListener) }
95
96
file.putUserData(KEY_REAL_TIME_EDIT_LISTENER , null )
96
97
}
97
98
}
@@ -175,7 +176,7 @@ class TextDocumentServiceHandler(
175
176
) {
176
177
val listener = file.getUserData(KEY_REAL_TIME_EDIT_LISTENER )
177
178
if (listener != null ) {
178
- FileDocumentManager .getInstance().getDocument(file)?.removeDocumentListener(listener)
179
+ tryOrNull { FileDocumentManager .getInstance().getDocument(file)?.removeDocumentListener(listener) }
179
180
file.putUserData(KEY_REAL_TIME_EDIT_LISTENER , null )
180
181
181
182
cs.launch {
You can’t perform that action at this time.
0 commit comments