VS Code: decoration-based matching, Ctrl+K bindings, README overhaul (from dev f8451715e657)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-27 17:02:41 +02:00
parent 2eb16791d2
commit 6abb0fd3dd
10 changed files with 255 additions and 39 deletions

View File

@@ -283,6 +283,26 @@ class Server:
'kind': 1})
self.reply(msg_id, highlights)
def on_klammertext_matchInfo(self, msg_id, params):
"""Custom request: the full matching story for a cursor position —
token, matching token, and whether the pair mismatches. The VS Code
extension draws its live match/mismatch decorations from this
(documentHighlight is word-gated in VS Code, so a bare @ close would
never trigger it; and it cannot carry the mismatch flag)."""
uri = params['textDocument']['uri']
text = self.docs.get(uri, '')
m = KE.match_at(text, pos_to_offset(text, params['position']))
if m is None:
self.reply(msg_id, None)
return
self.reply(msg_id, {
'token': offsets_to_range(text, *m['token']),
'matchToken': (offsets_to_range(text, *m['match_token'])
if m['match_token'] is not None else None),
'mismatch': m['mismatch'],
'message': m['message'],
})
def on_textDocument_definition(self, msg_id, params):
uri = params['textDocument']['uri']
text = self.docs.get(uri, '')