Skip to content

[Breaking]: Part 1 of 2 Restrict visibility, add immutability, refactor internals…#124

Merged
danipen merged 4 commits into
danipen:masterfrom
udlose:fix/gethashcode-sealed-visibility-issues
Mar 8, 2026
Merged

[Breaking]: Part 1 of 2 Restrict visibility, add immutability, refactor internals…#124
danipen merged 4 commits into
danipen:masterfrom
udlose:fix/gethashcode-sealed-visibility-issues

Conversation

@udlose

@udlose udlose commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

Warning

Breaking API changes

Partially addresses #123

Part 1 of 2 Restrict visibility, add immutability, refactor internals to match parity with upstream: TM4e repo: https://github.com/eclipse-tm4e/tm4e/tree/main/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal

Converted many classes and members to internal or sealed, and marked fields as readonly to improve encapsulation and immutability. Refactored utility classes to static, updated method visibility, and simplified JSONPListParser logic. These changes clarify API boundaries, prevent misuse, and enhance maintainability and thread safety.

udlose added 3 commits March 7, 2026 10:28
… to match partity with upstream: TM4e repo: https://github.com/eclipse-tm4e/tm4e/tree/main/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal

Converted many classes and members to internal or sealed, and marked fields as readonly to improve encapsulation and immutability. Refactored utility classes to static, updated method visibility, and simplified JSONPListParser logic. These changes clarify API boundaries, prevent misuse, and enhance maintainability and thread safety.
…y, internal methods

Refactored LineTokens to be sealed and updated fields to readonly for improved immutability. Removed unused _lineText field and constructor parameter. Changed public methods to internal for better encapsulation. Cleaned up code and removed unnecessary fields.
TokenizeLineResult2 is now sealed, preventing inheritance and
potential subclassing. This change improves code safety and
may offer performance benefits.

@danipen danipen left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good, please check a couple of comments.

Comment thread src/TextMateSharp/Internal/Rules/RuleId.cs Outdated
Comment thread src/TextMateSharp/Internal/Rules/RuleId.cs
@danipen danipen merged commit c615bfd into danipen:master Mar 8, 2026
5 checks passed
udlose added a commit to udlose/TextMateSharp that referenced this pull request Mar 8, 2026
Strengthen encapsulation and immutability

Several classes changed from public to internal and sealed, with fields and methods updated to internal and readonly where appropriate. GrammarNames made static; SupportedGrammars is now readonly. These changes improve code safety and clarify usage boundaries.
fuzzzerd pushed a commit to fuzzzerd/SharpFM that referenced this pull request Jun 30, 2026
Updated
[TextMateSharp.Grammars](https://github.com/danipen/TextMateSharp) from
2.0.3 to 2.0.4.

<details>
<summary>Release notes</summary>

_Sourced from [TextMateSharp.Grammars's
releases](https://github.com/danipen/TextMateSharp/releases)._

## 2.0.4

## What's Changed
* Fix AttributedScopeStack equality type check by @​Copilot in
danipen/TextMateSharp#111
* Fix multiple race conditions in TMModel #​109 by @​udlose in
danipen/TextMateSharp#114
* Performance/reduce allocations, increase test coverage, configure code
coverage, fix race condition by @​udlose in
danipen/TextMateSharp#115
* Fix #​116 and Performance/reduce allocations by @​udlose in
danipen/TextMateSharp#121
* [Breaking]: Fixes #​117 - Fix typo: rename PushAtributed to
PushAttributed by @​udlose in
danipen/TextMateSharp#122
* [Breaking]: Part 1 of 2 Restrict visibility, add immutability,
refactor internals… by @​udlose in
danipen/TextMateSharp#124
* Part 2 of 3 for #​123 - Fix sealed & visibility issues part2 by
@​udlose in danipen/TextMateSharp#125
* Update onigwrap to 1.0.11 by @​pauldumais in
danipen/TextMateSharp#127
* Add x86 assembly grammar by @​RysteQ in
danipen/TextMateSharp#129
* Update CI workflows to use .NET 8 SDK by @​danipen in
danipen/TextMateSharp#130

## New Contributors
* @​Copilot made their first contribution in
danipen/TextMateSharp#111
* @​udlose made their first contribution in
danipen/TextMateSharp#114
* @​pauldumais made their first contribution in
danipen/TextMateSharp#127
* @​RysteQ made their first contribution in
danipen/TextMateSharp#129

**Full Changelog**:
danipen/TextMateSharp@v2.0.3...v2.0.4

Commits viewable in [compare
view](danipen/TextMateSharp@v2.0.3...v2.0.4).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=TextMateSharp.Grammars&package-manager=nuget&previous-version=2.0.3&new-version=2.0.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants