[mod] symbol ranges
This commit is contained in:
parent
2d0ae19026
commit
fc56a3d505
5 changed files with 52 additions and 39 deletions
|
|
@ -3,8 +3,8 @@ const view = new lsp.EditorView({
|
|||
parent: document.getElementById("editor")
|
||||
});
|
||||
let doc = "xquery version '3.1';\n(:~ comment:)\nmodule namespace pdfbox='ns';\n";
|
||||
var client;
|
||||
var extLint;
|
||||
var client; // https://codemirror.net/docs/ref/#lsp-client
|
||||
var extLsp; // https://codemirror.net/docs/ref/#lsp-client.LSPPlugin
|
||||
var workspace = {
|
||||
"file:///some/file.xqm": null
|
||||
};
|
||||
|
|
@ -74,8 +74,9 @@ $("cmdList").onclick = e => {
|
|||
$("symList").addEventListener("itemSelected", e => {
|
||||
const sel = e.detail.selectionRange;
|
||||
console.log("SYM selection range", sel);
|
||||
const an = 17 * e.detail.kind
|
||||
view.dispatch({ selection: { anchor: an, head: an + 34 }, scrollIntoView: true });
|
||||
const an = extLsp.fromPosition(sel.start)
|
||||
const hd = extLsp.fromPosition(sel.end)
|
||||
view.dispatch({ selection: { anchor: an, head: hd}, scrollIntoView: true });
|
||||
});
|
||||
|
||||
$("lint").onclick = async e => {
|
||||
|
|
@ -158,7 +159,7 @@ function connect() {
|
|||
client.connect(transport);
|
||||
$("popConnect").hidePopover();
|
||||
$("tConnect").checked=true;
|
||||
let extLsp = client.plugin(file, "xquery");
|
||||
extLsp = client.plugin(file, "xquery");
|
||||
|
||||
view.dispatch({
|
||||
effects: lsp.StateEffect.appendConfig.of(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue