[fix] symbol center

This commit is contained in:
Andy Bunce 2025-11-19 23:03:51 +00:00
parent bc4b12fa6d
commit 04134c720b
3 changed files with 11 additions and 3 deletions

View file

@ -1,7 +1,8 @@
Work in progress. Work in progress.
An attempt to write a [Language Server Protocol](https://en.wikipedia.org/wiki/Language_Server_Protocol) server for and in XQuery 4.0. It tracks the draft specifications at https://qt4cg.org/ An attempt to write a [Language Server Protocol](https://en.wikipedia.org/wiki/Language_Server_Protocol) server for and in XQuery 4.0. It tracks the draft specifications at https://qt4cg.org/
It written for BaseX 12.0 and uses the [BaseX websocket](https://docs.basex.org/main/WebSockets) feature. It written for BaseX 12.0 and uses the [BaseX websocket](https://docs.basex.org/main/WebSockets) feature. See [The WebSocket Protocol
RFC 6455](https://www.rfc-editor.org/rfc/rfc6455.html)
# Demo # Demo
The demos expect `Docker` or `Podman` on the local machine. This is only a requirement for the demos. The demos expect `Docker` or `Podman` on the local machine. This is only a requirement for the demos.

View file

@ -36,7 +36,7 @@ module namespace set = "http://qt4cg.org/atomic-set";
except as fn($set as set:atomic-set, $value as set:atomic-set) as set:atomic-set, except as fn($set as set:atomic-set, $value as set:atomic-set) as set:atomic-set,
* ); * );
declare %private variable DATA := "'_data'"; declare %private variable $DATA := "'_data'";
(: (:
The private function set:replaceData processes the internal map The private function set:replaceData processes the internal map

View file

@ -85,7 +85,14 @@ $("symList").addEventListener("itemSelected", e => {
console.log("SYM selection range", sel); console.log("SYM selection range", sel);
const an = plugin.fromPosition(sel.start) const an = plugin.fromPosition(sel.start)
const hd = plugin.fromPosition(sel.end) const hd = plugin.fromPosition(sel.end)
view.dispatch({ selection: { anchor: an, head: hd }, scrollIntoView: true }); //view.dispatch({ selection: { anchor: an, head: hd }, scrollIntoView: true });
view.dispatch({
selection: { anchor: an, head: hd },
scrollIntoView: true ,
effects: [lsp.EditorView.scrollIntoView(an,{y:"center"})]
});
}); });
$("lint").onclick = async e => { $("lint").onclick = async e => {