Skip to content

add synchronization package, improve handling of optional features#126

Merged
georghinkel merged 1 commit intomainfrom
synchronization-package
Feb 17, 2026
Merged

add synchronization package, improve handling of optional features#126
georghinkel merged 1 commit intomainfrom
synchronization-package

Conversation

@georghinkel
Copy link
Contributor

@georghinkel georghinkel commented Feb 17, 2026

Summary by MergeMonkey

  • New Features:
    • Added synchronization package with supporting NuGet spec and binaries
    • Introduced CalculateStartOffset, CalculateEndOffset, and CreateEdit helper methods in Parser to centralize TextEdit creation
  • Bug Fixes:
    • Fixed token handling in ParseObject to return true only when a model token exists
    • Added null guard in LspTypesMapper.MapWorkspaceEdit for safe handling of null changes
    • Improved CollectionChangeListener by filtering items with OfType to prevent invalid casts
  • Chores:
    • Updated solution file version and added new package files to project list
    • Adjusted package tags and dependencies in nuspec files

@mergemonkeyhq
Copy link

mergemonkeyhq bot commented Feb 17, 2026

Walkthrough

The PR introduces a new synchronization package and refactors the parser to use dedicated helper methods for offset calculations and edit creation, improving readability and maintainability. It also adds defensive null checks and type filtering to enhance robustness across LSP mapping and collection change tracking. Metadata, tags, and history logs are updated to reflect the new functionality.

Changes (File-by-file breakdown)

File Changes
AnyText/AnyText.Core/Parser.cs Extracted offset computation into CalculateStartOffset and CalculateEndOffset, and added CreateEdit to centralize TextEdit generation, simplifying the edit creation flow
AnyText/NMF-Anytext-Sync.nuspec Created new NuGet package definition for AnyText synchronization, including metadata, dependencies, and file entries for binaries and documentation
AnyText/AnyText.Core/Model/ParseObject.cs Modified TryPeekModelToken and TryConsumeModelToken to return true only when modelToken is not null, fixing null‑token handling
AnyText/AnyText.Generator/Transformation/AnytextCodeGenerator.cs Performed minor cleanup in code generation method without altering functionality
AnyText/AnyText.Lsp/LspTypesMapper.cs Added null check for changes parameter in MapWorkspaceEdit to safely return null when no changes are provided
AnyText/AnyText.history Updated history entries to record addition of synchronization package and minor transaction synchronization changes
AnyText/NMF-Anytext-LSP.nuspec Changed package tags from GLSP to LSP to reflect correct technology focus
AnyText/NMF-Anytext.nuspec Removed GLSP tag from package metadata
Expressions/Expressions.history Added history entries for improved FirstOrDefault and a fix for cast exceptions when handling non‑model collections
Expressions/Expressions/Execution/CollectionChangeListener.cs Imported System.Linq and filtered moved, replacing, and removed items using OfType<T> to prevent invalid casts
NMF.sln Removed VisualStudioVersion suffix and added synchronization package files to solution project list

Sequence Diagram

sequenceDiagram
    participant Parser
    participant Helper
    participant TextEdit
    participant LspMapper
    participant Listener
    Parser->>Helper: CalculateStartOffset(...)
    Parser->>Helper: CalculateEndOffset(...)
    Parser->>Helper: CreateEdit(...)
    Helper->>TextEdit: new TextEdit(...)
    LspMapper->>LspMapper: if changes == null return null
    Listener->>Listener: foreach movedItems.OfType<T>()
    Listener->>Listener: foreach replacingItems.OfType<T>()
    Listener->>Listener: foreach replacedItems.OfType<T>()
Loading

Dig Deeper With Commands

  • /review <file-path> <function-optional>
  • /chat <file-path> "<question>"
  • /roast <file-path>

Runs only when explicitly triggered.

@georghinkel georghinkel merged commit e9b9cdc into main Feb 17, 2026
1 check passed
@georghinkel georghinkel deleted the synchronization-package branch February 17, 2026 16:16
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.

1 participant