Skip to content

Commit

Permalink
Partial compatibility with 2024.3
Browse files Browse the repository at this point in the history
  • Loading branch information
l2dy committed Sep 15, 2024
1 parent c56524d commit 9f9880f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class CargoConsoleView(project: Project, searchScope: GlobalSearchScope, viewer:
private var hasErrors = false

override fun doCreateConsoleEditor(): EditorEx {
val editor = super.doCreateConsoleEditor()
editor.document.addDocumentListener(object : DocumentListener {
val editorEx = super.doCreateConsoleEditor()
editorEx.document.addDocumentListener(object : DocumentListener {
override fun documentChanged(e: DocumentEvent) {
if ("error" !in e.newFragment) return

Expand All @@ -37,14 +37,14 @@ class CargoConsoleView(project: Project, searchScope: GlobalSearchScope, viewer:
private fun processLine(lineNumber: Int, line: CharSequence) {
if (ERROR_RE.matches(line)) {
if (!hasErrors) {
getEditor().caretModel.moveToLogicalPosition(LogicalPosition(lineNumber - 1, 0))
getEditor().scrollingModel.scrollToCaret(ScrollType.CENTER)
editor!!.caretModel.moveToLogicalPosition(LogicalPosition(lineNumber - 1, 0))
editor!!.scrollingModel.scrollToCaret(ScrollType.CENTER)
}
hasErrors = true
}
}
})
return editor
return editorEx
}

override fun scrollToEnd() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/org/rust/ide/console/RsConsoleActions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class SoftWrapAction(private val consoleView: RsConsoleView) :
override fun isSelected(e: AnActionEvent): Boolean = isSelected

private fun updateEditors() {
consoleView.editor.settings.isUseSoftWraps = isSelected
consoleView.editor!!.settings.isUseSoftWraps = isSelected
consoleView.consoleEditor.settings.isUseSoftWraps = isSelected
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/org/rust/ide/console/RsConsoleView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RsConsoleView(project: Project) : LanguageConsoleImpl(project, VIRTUAL_FIL
virtualFile.putUserData(RUST_CONSOLE_KEY, true)
// Mark editor as console one, to prevent autopopup completion
historyViewer.putUserData(ConsoleViewUtil.EDITOR_IS_CONSOLE_HISTORY_VIEW, true)
super.setPrompt(PROMPT)
prompt = PROMPT
consolePromptDecorator.indentPrompt = INDENT_PROMPT
setUpdateFoldingsEnabled(false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RsPathsExcludeTable(project: Project) : ListTableWithButtons<Item>() {
setValues(getSettingsItems())
}

override fun createListModel(): ListTableModel<*> = ListTableModel<Item>(PATH_COLUMN, TYPE_COLUMN, SCOPE_COLUMN)
override fun createListModel(): ListTableModel<Item> = ListTableModel<Item>(PATH_COLUMN, TYPE_COLUMN, SCOPE_COLUMN)

override fun createElement(): Item = Item("", ExclusionType.ItemsAndMethods, ExclusionScope.IDE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ object RsInnerAttributeOwnerRegistry {
return filterOuterAttrs(stub.childrenStubs).mapToMetaItems()
}

private fun filterOuterAttrs(childrenStubs: List<StubElement<PsiElement>>): Sequence<StubElement<PsiElement>> =
private fun filterOuterAttrs(childrenStubs: List<StubElement<*>>): Sequence<StubElement<*>> =
childrenStubs.asSequence().filter { it.stubType == RsElementTypes.OUTER_ATTR }

private fun Sequence<StubElement<*>>.mapToMetaItems(): Sequence<RsMetaItemStub> =
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/org/rust/lang/doc/psi/impl/Psi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class RsDocElementImpl(type: IElementType) : CompositePsiElement(type),
override fun toString(): String = "${javaClass.simpleName}($elementType)"
}

class RsDocGapImpl(type: IElementType, val text: CharSequence) : LeafPsiElement(type, text), RsDocGap {
class RsDocGapImpl(type: IElementType, text: CharSequence) : LeafPsiElement(type, text), RsDocGap {
override fun getTokenType(): IElementType = elementType
}

Expand Down

0 comments on commit 9f9880f

Please sign in to comment.