Skip to content

Commit

Permalink
fix(intellij): resolve issue with initialization getting stuck due to…
Browse files Browse the repository at this point in the history
… an editor with null virtualFile. (#2658)
  • Loading branch information
icycodes authored Jul 16, 2024
1 parent f761e85 commit 269844e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clients/intellij/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tasks {
}

patchPluginXml {
sinceBuild.set("231.*")
sinceBuild.set("231")
untilBuild.set("241.*")
changeNotes.set(provider {
changelog.renderItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ class TextDocumentSync(private val project: Project) : Disposable {

companion object {
fun buildDidOpenTextDocumentParams(editor: Editor): DidOpenTextDocumentParams? {
val virtualFile = editor.virtualFile ?: return null
val psiManager = editor.project?.let { PsiManager.getInstance(it) } ?: return null
return DidOpenTextDocumentParams(
TextDocumentItem(
editor.virtualFile.url,
editor.virtualFile.let { psiManager.findFileWithReadLock(it) }?.getLanguageId() ?: "plaintext",
virtualFile.url,
virtualFile.let { psiManager.findFileWithReadLock(it) }?.getLanguageId() ?: "plaintext",
editor.document.modificationStamp.toInt(),
editor.document.text,
)
Expand Down

0 comments on commit 269844e

Please sign in to comment.