Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
1b50291
fix(deps): update dependency org.robolectric:robolectric to v4.16.1
renovate[bot] Jan 21, 2026
cbbe95f
Merge pull request #794 from Rosemoe/renovate/org.robolectric-robolec…
Rosemoe Jan 28, 2026
6f67c6f
Update DefaultCompletionLayout.java
nullij Feb 3, 2026
0535af5
Merge pull request #800 from nullij/patch-1
Rosemoe Feb 4, 2026
b3a8b17
refact(editor): expose `variableResolver` for custom variable resolve…
Rosemoe Feb 6, 2026
533c6dc
chore(editor): refer to inlay hint type names in inlay hint renderers
Rosemoe Feb 6, 2026
0eff59f
fix(editor): add max text length for accessibility node info
Rosemoe Feb 8, 2026
27a6cc4
build(app): migrate signing config to environment variables
Rosemoe Feb 8, 2026
d0e0916
build(app): move signing config vars to job-level env
Rosemoe Feb 8, 2026
9f20f82
docs(textmate): update README.md for TextMate
Rosemoe Feb 8, 2026
efbacac
fix(editor): `SymbolInputView` always overrides the background define…
Rosemoe Feb 8, 2026
099b8be
refact(app): migrate to Material 3
Rosemoe Feb 8, 2026
56e7166
fix(editor): non-null param is declared nullable in `SpanExternalRend…
Rosemoe Feb 9, 2026
77c8ab7
fix(editor): text style in line info panel can be affected by content…
Rosemoe Feb 9, 2026
795f2f0
fix(app): inconsistent inlay hint position in demo
Rosemoe Feb 9, 2026
1bf3548
docs: update screenshots in project README
Rosemoe Feb 9, 2026
b6f8384
fix: fix `ConcurrentModificationException` and expose language server…
KonerDev Feb 10, 2026
db7d487
feat: improve LSP server lifecycle and error handling
KonerDev Feb 11, 2026
7cfa568
chore(deps): update plugin publish to v0.36.0
renovate[bot] Feb 12, 2026
89799c0
chore(deps): update gradle/actions action to v5
renovate[bot] Feb 12, 2026
16c99d0
chore(deps): update agp to v9.0.1
renovate[bot] Feb 13, 2026
87fa0f3
fix(editor-lsp): improve editor lifecycle
KonerDev Feb 18, 2026
76b9f73
refactor(editor-lsp): move exception handling to separate method
KonerDev Feb 19, 2026
700c744
fix: stopping server does no longer disconnect all servers
KonerDev Feb 19, 2026
c5b7349
fix(deps): update dependency org.jruby.jcodings:jcodings to v1.0.64
renovate[bot] Feb 20, 2026
f361f25
Merge pull request #804 from KonerDev/fix/concurrent-exception
Rosemoe Feb 20, 2026
f4111ff
Merge pull request #807 from Rosemoe/renovate/org.jruby.jcodings-jcod…
Rosemoe Feb 20, 2026
2093386
fix: fix unnecessary stop of language server wrapper by tracking conn…
KonerDev Feb 20, 2026
46a9bd5
Merge pull request #808 from KonerDev/fix/unnecessary-stop
Rosemoe Feb 21, 2026
99624d5
feat: add disable-feature option to server definition (Closes #802)
KonerDev Feb 21, 2026
084af3c
fix: fix hover window not showing (Closes #796)
KonerDev Feb 21, 2026
004e85b
fix(deps): update dependency org.jruby.joni:joni to v2.2.7
renovate[bot] Feb 25, 2026
fe24675
Merge pull request #809 from KonerDev/feat/disable-ls-features
Rosemoe Feb 25, 2026
42a4175
Merge pull request #810 from Rosemoe/renovate/org.jruby.joni-joni-2.x
Rosemoe Feb 25, 2026
9242793
Merge pull request #805 from Rosemoe/renovate/agp
Rosemoe Feb 25, 2026
07b035a
fix: possible null reference in `EditorRenderer#applySelectedTextRange`
Rosemoe Feb 25, 2026
cd9a784
Merge remote-tracking branch 'origin/main'
Rosemoe Feb 25, 2026
813bac9
Merge pull request #791 from Rosemoe/renovate/com.vanniktech.maven.pu…
Rosemoe Feb 25, 2026
f55af1c
feat(deps): update Kotlin to v2.3.10
Rosemoe Feb 25, 2026
f07397e
fix(deps): update dependency org.eclipse.lsp4j:org.eclipse.lsp4j to v1
renovate[bot] Feb 27, 2026
09bec91
fix(editor): fix `IndexOutOfBoundsException` on completion
KonerDev Feb 28, 2026
30c1ddc
Merge pull request #812 from KonerDev/fix/oob-completion
Rosemoe Mar 1, 2026
be49c69
fix(editor): leading whitespace is sometimes wrongly hidden
Rosemoe Mar 3, 2026
5d49f36
refact(editor): store text in byte array instead of char array to cut…
Rosemoe Mar 3, 2026
59717e6
Merge remote-tracking branch 'origin/main'
Rosemoe Mar 3, 2026
ca60f69
test(editor): add test for `ContentLine`
Rosemoe Mar 3, 2026
10370f8
perf(editor): avoid copying when create `String` in Latin1 implementa…
Rosemoe Mar 3, 2026
36306af
feat(editor): add experimental shallow copying in `AsyncIncrementalAn…
Rosemoe Mar 3, 2026
d9e5ba5
fix(editor): missing support for multiline code block with more than …
Rosemoe Mar 3, 2026
6f97f74
feat(app): add sample for paged editing for long files
Rosemoe Mar 4, 2026
c28ca33
Merge pull request #753 from Rosemoe/renovate/gradle-actions-5.x
Rosemoe Mar 5, 2026
7ccb3f6
docs: fix license badge
Rosemoe Mar 5, 2026
4216bd9
Merge remote-tracking branch 'origin/main'
Rosemoe Mar 5, 2026
22c6a82
fix(lsp): app crash when `textDocument/inlayHint` or `textDocument/do…
Rosemoe Mar 5, 2026
fdb0a2a
feat(lsp): partially support API changes in LSP4J v1.0 (LSP v3.18.0)
Rosemoe Mar 5, 2026
acdc2fd
fix(ci): `branches-ignore` field for renovate is wrong
Rosemoe Mar 5, 2026
2d06427
chore(deps): update actions/upload-artifact action to v7
renovate[bot] Mar 5, 2026
439456f
Merge pull request #803 from Rosemoe/renovate/major-lsp4j
Rosemoe Mar 5, 2026
aa3b884
Merge pull request #811 from Rosemoe/renovate/major-github-artifact-a…
Rosemoe Mar 5, 2026
298544e
feat(editor): add option to ensure search occurrence is visible
KonerDev Mar 7, 2026
def1d57
chore(deps): update styfle/cancel-workflow-action action to v0.13.1
renovate[bot] Mar 11, 2026
9443e01
fix: only use SpanFactory.obtain when underline is needed in TextMate…
META-Xiao Mar 13, 2026
d349902
test: add unit tests for span selection logic in TextMateAnalyzer
META-Xiao Mar 13, 2026
cbe3d28
fix(monarch): underline color leads to failure in analyzer (similar i…
Rosemoe Mar 13, 2026
c31940f
Merge pull request #820 from META-Xiao/fix/textmate-span-underline-op…
Rosemoe Mar 13, 2026
f21898e
Merge remote-tracking branch 'origin/main'
Rosemoe Mar 13, 2026
9f6ad9f
feat(editor): add experimental minimap, disabled by default (#766)
Rosemoe Mar 14, 2026
0bb17e4
Merge pull request #816 from KonerDev/feat/searcher-occurence
Rosemoe Mar 14, 2026
20a7b8d
chore(minimap): add doc comment for `MinimapCharRenderer` and replace…
Rosemoe Mar 14, 2026
32b6e2f
docs(editor): add some clarifications in `Language` doc comments
Rosemoe Mar 14, 2026
b10bd9a
chore(langs): make exception message more detail
Rosemoe Mar 15, 2026
b9bd53d
fix(editor): empty spans in `Styles` may lead to NPE
Rosemoe Mar 15, 2026
7cdb8b0
fix(editor): render nodes of sticky lines are abandoned, leading to u…
Rosemoe Mar 15, 2026
6bcea90
feat(editor): send partial spans as the analysis goes
Rosemoe Mar 15, 2026
b39ad1b
fix(textmate): underline without explicit color leads failure in Text…
Rosemoe Mar 16, 2026
76695be
refact(editor): move minimap config fields to data class
Rosemoe Mar 16, 2026
0fdd4a8
chore: bump version to 0.24.5
Rosemoe Mar 16, 2026
1528e5b
fix(publishing): migrate to new variant ctor API
Rosemoe Mar 16, 2026
a234d64
chore(deps): update gradle to v9.4.1
renovate[bot] Mar 19, 2026
bf3f211
Merge pull request #817 from Rosemoe/renovate/styfle-cancel-workflow-…
Rosemoe Mar 23, 2026
e106a90
Merge pull request #799 from Rosemoe/renovate/gradle-9.x
Rosemoe Mar 24, 2026
91051f3
chore: fix comment grammar
Rosemoe Mar 26, 2026
a80022a
chore(editor): add min width for minimap region
Rosemoe Mar 26, 2026
8d30f21
Merge remote-tracking branch 'origin/main'
Rosemoe Mar 26, 2026
8729111
chore(editor): add doc comments for minimap
Rosemoe Mar 26, 2026
4072aac
chore(deps): update agp to v9.1.0
renovate[bot] Mar 27, 2026
a26f630
Merge pull request #815 from Rosemoe/renovate/agp
Rosemoe Mar 27, 2026
2a3527d
chore(oniguruma): update CMake version
Rosemoe Mar 28, 2026
c5108b2
Merge remote-tracking branch 'origin/main'
Rosemoe Mar 28, 2026
9d621da
chore(build): refer to version catalog for plugins
Rosemoe Mar 28, 2026
73140d6
fix(app): text should be truncated if it's too long for parcel
Rosemoe Mar 28, 2026
6ac5526
chore(app): update content of `View.java`
Rosemoe Mar 29, 2026
9c3ae99
feat(editor): improve algorithm of collecting sticky lines
Rosemoe Mar 29, 2026
2cf0f42
fix(lsp): signature text generation assumes provided parameter label …
Rosemoe Mar 30, 2026
ec4ee3e
refact(textmate): add proper documentation for `TextMateLanguage`; re…
Rosemoe Mar 30, 2026
8c61226
refact(editor): remove deprecated method in `EditorSearcher`
Rosemoe Mar 30, 2026
c39c8d1
feat(editor): add inlay hint setter in style receiver
Rosemoe Mar 31, 2026
0aed545
feat: enhance document color support and inlay hints
KonerDev Apr 2, 2026
e368650
Merge pull request #830 from KonerDev/feat/inlay
Rosemoe Apr 2, 2026
b5b1bc8
chore: update `soraX`
KonerDev Apr 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.13.0
uses: styfle/cancel-workflow-action@0.13.1
with:
access_token: ${{ github.token }}

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
******************************************************************************/

plugins {
id("com.android.application")
alias(libs.plugins.android.application)
}

android {
Expand Down
3,455 changes: 3,061 additions & 394 deletions app/src/main/assets/samples/big_sample.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/src/main/assets/tree-sitter-queries/java/blocks.scm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; Code block patterns for editor
; Capture names for scopes does not matter much in sora-editor implementation, you may use 'abc', 'test.xyz', etc.
; General, editor considers the captured node's region as code block region.
; Generally, editor considers the captured node's region as code block region.
; However, capture name with '.marked' suffix is special. The last terminal node's start position in the capture will be the end position of the block
; 'terminal node' refers to a node without children

Expand Down
13 changes: 10 additions & 3 deletions app/src/main/java/io/github/rosemoe/sora/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import android.graphics.Typeface
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.PersistableBundle
import android.text.Editable
import android.text.TextWatcher
import android.util.Log
Expand All @@ -40,7 +39,6 @@ import android.widget.PopupMenu
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts.GetContent
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.lifecycle.lifecycleScope
import androidx.savedstate.write
import com.google.android.material.dialog.MaterialAlertDialogBuilder
Expand Down Expand Up @@ -659,7 +657,16 @@ class MainActivity : AppCompatActivity() {
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.write {
putString("text", binding.editor.text.toString())
// For production, you may need to store the text to external storage to avoid data loss
val text = binding.editor.text.toString().let {
val limit = 128 * 1024
if (it.length > limit) {
it.substring(0, limit)
} else {
it
}
}
putString("text", text)
putFloat("font.size", binding.editor.textSizePx)
putInt("position.left", binding.editor.cursor.left)
putInt("position.right", binding.editor.cursor.right)
Expand Down
2 changes: 1 addition & 1 deletion build-logic/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion editor-bom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


plugins {
id("com.vanniktech.maven.publish.base")
alias(libs.plugins.publish)
id("java-platform")
}

Expand Down
4 changes: 2 additions & 2 deletions editor-lsp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
* additional information or have any questions
******************************************************************************/
plugins {
id("com.android.library")
alias(libs.plugins.android.library)
// alias(libs.plugins.publish)
id("org.jetbrains.kotlin.android")
//id("com.vanniktech.maven.publish.base")
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ class LspEditor(
if (capabilities.inlayHintProvider?.left != false || capabilities.inlayHintProvider?.right != null) {
requestInlayHint(CharPosition(0, 0))
}
requestDocumentColor()

status = LspEditorStatus.CONNECTED
}.onFailure {
Expand Down Expand Up @@ -365,6 +366,9 @@ class LspEditor(
uiDelegate.showDocumentColors(documentColors)
}

fun getAllColorOccurrences(): List<ColorInformation> {
return uiDelegate.cachedDocumentColors ?: return emptyList()
}

fun hitReTrigger(eventText: CharSequence): Boolean {
for (trigger in signatureHelpReTriggers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ internal class LspEditorUIDelegate(private val editor: LspEditor) {
private var codeActionWindowRef: WeakReference<CodeActionWindow?> = WeakReference(null as CodeActionWindow?)

private var cachedInlayHints: List<InlayHint>? = null
private var cachedDocumentColors: List<ColorInformation>? = null
internal var cachedDocumentColors: List<ColorInformation>? = null
private set

var isEnableHover = true
set(value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import io.github.rosemoe.sora.lsp.events.document.documentChange
import io.github.rosemoe.sora.lsp.events.highlight.DocumentHighlightEvent
import io.github.rosemoe.sora.lsp.events.highlight.documentHighlight
import io.github.rosemoe.sora.lsp.events.hover.hover
import io.github.rosemoe.sora.lsp.events.inlayhint.inlayHint
import io.github.rosemoe.sora.lsp.events.signature.signatureHelp
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand All @@ -52,7 +51,6 @@ class LspEditorContentChangeEvent(private val editor: LspEditor) :
return
}


editor.coroutineScope.launch(Dispatchers.IO) {
// send to server
editor.eventManager.emitAsync(EventType.documentChange, event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import io.github.rosemoe.sora.lang.styling.inlayHint.ColorInlayHint
import io.github.rosemoe.sora.lsp.events.EventType
import io.github.rosemoe.sora.lsp.events.color.documentColor
import io.github.rosemoe.sora.lsp.events.inlayhint.inlayHint
import io.github.rosemoe.sora.lsp.utils.asTextRange
import io.github.rosemoe.sora.text.CharPosition
import org.eclipse.lsp4j.ColorInformation
import org.eclipse.lsp4j.InlayHint
Expand Down Expand Up @@ -84,15 +85,17 @@ fun List<ColorInformation>.colorInfoToDisplay() = map {
// Always show on start
// May we should use style patch to set background?
ColorInlayHint(
it.range.start.line, it.range.start.character,
ConstColor(
line = it.range.start.line,
column = it.range.start.character,
color = ConstColor(
Color.argb(
it.color.alpha.toFloat(),
it.color.red.toFloat(),
it.color.green.toFloat(),
it.color.blue.toFloat()
)
)
),
colorRange = it.range.asTextRange()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@ class DefaultSignatureHelpLayout : SignatureHelpLayout {
builder.append("(")
for (i in parameters.indices) {
val parameter = parameters[i]
val label = parameter.label.left
val label = if (parameter.label.isLeft) {
parameter.label.left
} else {
val range = parameter.label.right
signature.label.substring(range.first until range.second)
}
val spanStart = builder.length
builder.append(label)
val highlight = parameter == activeParameter && activeParameterIndex >= 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import io.github.rosemoe.sora.lang.diagnostic.DiagnosticsContainer
import io.github.rosemoe.sora.lang.styling.Span
import io.github.rosemoe.sora.lang.styling.Styles
import io.github.rosemoe.sora.lang.styling.TextStyle
import io.github.rosemoe.sora.lang.styling.inlayHint.InlayHintsContainer
import io.github.rosemoe.sora.text.Content
import io.github.rosemoe.sora.text.ContentReference
import io.github.rosemoe.sora.widget.schemes.EditorColorScheme
Expand Down Expand Up @@ -180,6 +181,12 @@ open class EmptyStyleReceiver : StyleReceiver {
) {
}

override fun setInlayHints(
sourceManager: AnalyzeManager,
inlayHints: InlayHintsContainer?
) {
}

override fun updateBracketProvider(
sourceManager: AnalyzeManager,
provider: BracketsProvider?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ fun TextRange.asLspRange(): Range {
return Range(this.start.asLspPosition(), this.end.asLspPosition())
}

fun Range.asTextRange(): TextRange {
return TextRange(this.start.asCharPosition(), this.end.asCharPosition())
}

fun LspEditor.createDidOpenTextDocumentParams(): DidOpenTextDocumentParams {
val params = DidOpenTextDocumentParams()
params.textDocument = TextDocumentItem(
Expand Down
4 changes: 2 additions & 2 deletions editor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
******************************************************************************/

plugins {
id("com.android.library")
//id("com.vanniktech.maven.publish.base")
alias(libs.plugins.android.library)
// alias(libs.plugins.publish)
id("kotlin-android")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import io.github.rosemoe.sora.lang.brackets.BracketsProvider;
import io.github.rosemoe.sora.lang.diagnostic.DiagnosticsContainer;
import io.github.rosemoe.sora.lang.styling.Styles;
import io.github.rosemoe.sora.lang.styling.inlayHint.InlayHintsContainer;

/**
* A {@link StyleReceiver} receives spans and other styles from analyzers.
Expand Down Expand Up @@ -76,11 +77,17 @@ default void updateStyles(@NonNull AnalyzeManager sourceManager, @NonNull Styles
}

/**
* Specify new diagnostics. You can call it in any thread.
* Set new diagnostics. You can call it in any thread.
* The implementation of this method should make sure that concurrent invocations to it are safe.
*/
void setDiagnostics(@NonNull AnalyzeManager sourceManager, @Nullable DiagnosticsContainer diagnostics);

/**
* Set new inlay hints. You can call it in any thread.
* The implementation of this method should make sure that concurrent invocations to it are safe.
*/
void setInlayHints(@NonNull AnalyzeManager sourceManager, @Nullable InlayHintsContainer inlayHints);

/**
* Set new provider for brackets highlighting
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ public class Styles {
public Map<Class<?>, MutableInt> styleTypeCount;

public List<CodeBlock> blocks;
/**
* Internal, automatically generated
*/
public List<CodeBlock> blocksByStart;

public int suppressSwitch = Integer.MAX_VALUE;

Expand Down Expand Up @@ -268,10 +264,6 @@ public void finishBuilding() {
if (sort) {
Collections.sort(blocks, CodeBlock.COMPARATOR_END);
}
blocksByStart = new ArrayList<>(blocks);
Collections.sort(blocksByStart, CodeBlock.COMPARATOR_START);
} else {
blocksByStart = null;
}
if (lineStyles != null) {
Collections.sort(lineStyles);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package io.github.rosemoe.sora.lang.styling.inlayHint

import io.github.rosemoe.sora.lang.styling.color.ResolvableColor
import io.github.rosemoe.sora.text.TextRange

/**
* A simple text inlay hint
Expand All @@ -47,7 +48,8 @@ class TextInlayHint(
class ColorInlayHint(
line: Int,
column: Int,
val color: ResolvableColor
val color: ResolvableColor,
val colorRange: TextRange? = null
) : InlayHint(line, column, TYPE_NAME) {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,6 @@ public class DirectAccessProps implements Serializable {
@InvalidateRequired
public boolean stickyScrollPreferInnerScope = false;

/**
* Limit for sticky scroll dataset size
*/
public int stickyScrollIterationLimit = 1000;

/**
* Hide partially or all of the stuck lines when text is selected
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1025,51 +1025,66 @@ protected List<CodeBlock> getStuckCodeBlocks() {
int startLine = editor.getFirstVisibleLine();
int offsetY = editor.getOffsetY(), rowHeight = editor.getRowHeight();
List<CodeBlock> codeBlocks;
if ((styles = editor.getStyles()) == null || (codeBlocks = styles.blocksByStart) == null) {
if ((styles = editor.getStyles()) == null || (codeBlocks = styles.blocks) == null) {
return null;
}
int size = codeBlocks.size();
List<CodeBlock> candidates = new ArrayList<>();
var limit = editor.getProps().stickyScrollIterationLimit;
var maxLine = content.getLineCount();
for (int i = 0; i < size && i < limit; i++) {
var block = codeBlocks.get(i);
if (block == null || block.startLine > block.endLine ||
block.startLine > maxLine || block.endLine > maxLine ||
block.startLine < 0) {

List<CodeBlock> visibleBlocks = new ArrayList<>();
int first = editor.getFirstVisibleLine();
int last = editor.getLastVisibleLine();
boolean mark = false;
int invalidCount = 0;
int maxCount = styles.getSuppressSwitch();
int mm = editor.binarySearchEndBlock(first, codeBlocks);
if (mm == -1) {
mm = 0;
}
for (int curr = mm; curr < codeBlocks.size(); curr++) {
CodeBlock block = codeBlocks.get(curr);
if (block == null) {
continue;
}
if (block.startLine > startLine) {
break;
if (CodeEditor.hasVisibleRegion(block.startLine, block.endLine, first, last)) {
visibleBlocks.add(block);
mark = true;
} else if (mark) {
if (invalidCount >= maxCount) break;
invalidCount++;
}
}
// Sort visible blocks by start position and check constraints
Collections.sort(visibleBlocks, CodeBlock.COMPARATOR_START);
List<CodeBlock> finalCandidates = new ArrayList<>();
for (int i = 0; i < visibleBlocks.size(); i++) {
var block = visibleBlocks.get(i);
if (block.endLine > startLine && editor.getRowTop(block.startLine) - offsetY < 0) {
candidates.add(block);
finalCandidates.add(block);
startLine++;
offsetY += rowHeight;
}
}
var maxLines = editor.getProps().stickyScrollMaxLines;
if (candidates.size() > maxLines) {
if (finalCandidates.size() > maxLines) {
if (maxLines <= 0) {
return null;
}
if (editor.getProps().stickyScrollPreferInnerScope) {
candidates = candidates.subList(candidates.size() - maxLines, candidates.size());
finalCandidates = finalCandidates.subList(finalCandidates.size() - maxLines, finalCandidates.size());
} else {
candidates = candidates.subList(0, maxLines);
finalCandidates = finalCandidates.subList(0, maxLines);
}
}
if (editor.getCursor().isSelected() && editor.getProps().stickyScrollAutoCollapse) {
var limitLine = editor.getCursor().getLeftLine();
var firstVis = editor.getFirstVisibleLine();
int lastSelectionLine = editor.getCursor().getRightLine();
if (lastSelectionLine >= firstVis) {
while (!candidates.isEmpty() && firstVis + candidates.size() >= limitLine) {
candidates.remove(candidates.size() - 1);
while (!finalCandidates.isEmpty() && firstVis + finalCandidates.size() >= limitLine) {
finalCandidates.remove(finalCandidates.size() - 1);
}
}
}
return candidates;
return finalCandidates;
}

private final LineStyles coordinateLine = new LineStyles(0);
Expand Down
Loading
Loading