[mod] symbols install minimap

This commit is contained in:
Andy Bunce 2025-09-22 15:26:45 +01:00
parent 95aed988b6
commit 28b4799ee0
11 changed files with 846 additions and 167 deletions

View file

@ -7,6 +7,7 @@
<title>Codemirror6 example using BaseX LSP</title>
<link rel="icon" type="image/png" href="../favicon.png" />
<link href="../bootstrap@5.3.7.css" rel="stylesheet" />
<link href="../codicon/codicon.css" rel="stylesheet" />
<link rel="stylesheet" href="grail.css" />
</head>
@ -96,7 +97,7 @@
</main>
<aside class="page-sidebar">
<div id="msg">(msgs)</div>
<div id="msg">(msgs)<i class='codicon codicon-symbol-method'></i></div>
<select id="load">
<option selected value="">load..</option>
@ -126,8 +127,8 @@
<li>-</li>
</ul>
<details style="padding:5px;">
<summary class="bg-info">OutLine <b>0</b></summary>
<details id="symPanel" style="padding:5px;">
<summary class="bg-info">OutLine <b>0</b></summary>
<json-list id="symList" style="display:block; overflow:scroll; height: 10em;"></json-list>
</details>

View file

@ -1,5 +1,6 @@
/* Define the web component for settable list
https://stackoverflow.com/questions/50404970/web-components-pass-data-to-and-from
https://www.w3schools.com/howto/howto_js_treeview.asp
*/
class JsonListComponent extends HTMLElement {
#shadow;
@ -33,7 +34,7 @@ class JsonListComponent extends HTMLElement {
const shad=this.#shadow;
this.#data.forEach((item, index) => {
const listItem = document.createElement('li');
listItem.textContent = `${item.name} - ${item.description}`;
listItem.innerHTML = `<i class='codicon codicon-symbol-method'></i>${item.name} - ${item.detail}`;
// Adding a click event listener for user interaction
listItem.addEventListener('click', () => {
console.log('Item clicked:', item, listItem);

View file

@ -49,33 +49,8 @@ $("symbols2").onclick = e => {
client.request("textDocument/documentSymbol", { "textDocument": { "uri": $("iFile").value } })
.then(r => {
console.log("symbols", r)
var symbolData = [
{
"name": "symbol 1",
"description": "This is the first item"
},
{
"name": "symbol 2",
"description": "This is the second item"
},
{
"name": "symbol 3",
"description": "This is the third item"
},
{
"name": "symbol 4",
"description": "This is the third item"
},
{
"name": "symbol 5",
"description": "This is the third item"
},
{
"name": "symbol 6",
"description": "This is the third item"
}
];
$("symList").setData(symbolData);
$("symPanel").open=true;
$("symList").setData(r);
});
};