Skip to content

Fix RegistrationOptions encoding to correctly merge objects#55

Merged
rintaro merged 1 commit into
swiftlang:mainfrom
Steffeeen:fix-capability-encoding
May 26, 2026
Merged

Fix RegistrationOptions encoding to correctly merge objects#55
rintaro merged 1 commit into
swiftlang:mainfrom
Steffeeen:fix-capability-encoding

Conversation

@Steffeeen
Copy link
Copy Markdown
Member

The two members of the different RegistrationOptions should be encoded into a single object which contains the members of each of the two members. This accidentally broke in 7530abc.

By not merging the two objects, the encoding ended up like this:

"registerOptions": {
    "signatureHelpOptions": {
        "triggerCharacters": [
            "(",
            "["
        ],
        "retriggerCharacters": [
            ",",
            ":"
        ]
    },
    "textDocumentRegistrationOptions": {
        "documentSelector": [
            {
                "language": "swift"
            }
        ]
    }
}

while it should look like this:

"registerOptions": {
    "documentSelector": [
        {
            "language": "swift"
        }
    ],
    "triggerCharacters": [
        "(",
        "["
    ],
    "retriggerCharacters": [
        ",",
        ":"
    ]
}

This subsequently lead to the capabilities not being registered on the language server client, which leads to for example semantic tokens not working in VSCode.

The changes in LSPAny+Coding.swift are needed to ensure that we don't hit the precondition in the willset {} of storage.

The two members of the different `RegistrationOptions` should be
encoded into a single object which contains the members of each of the
two members.
Copy link
Copy Markdown
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thanks a lot for noticing and tracking this down 🙏🏽

Copy link
Copy Markdown
Member

@rintaro rintaro left a comment

Choose a reason for hiding this comment

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

Thank you!

@rintaro
Copy link
Copy Markdown
Member

rintaro commented May 26, 2026

@Steffeeen Could you open a PR for release/6.4.x branch? 🙏

@rintaro rintaro merged commit 7373d19 into swiftlang:main May 26, 2026
52 of 53 checks passed
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.

3 participants