style cleanup and alignment; keybinding additions; lsp config expansion

This commit is contained in:
itdominator 2024-04-09 00:19:21 -05:00
parent cb4b7faaaa
commit 238a05591d
9 changed files with 189 additions and 78 deletions

View File

@ -4,13 +4,14 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Newton2</title> <title>Newton2</title>
<!-- Bootstrap CSS --> <!-- Bootstrap CSS -->
<link rel="stylesheet" href="resources/css/libs/bootstrap5/bootstrap.min.css"> <link rel="stylesheet" href="resources/css/libs/bootstrap5/bootstrap.min.css"/>
<link rel="stylesheet" href="resources/css/libs/bootstrap-icons/bootstrap-icons.css"> <link rel="stylesheet" href="resources/css/libs/bootstrap-icons/bootstrap-icons.css"/>
<!-- Site CSS --> <!-- Site CSS -->
<!-- <link rel="stylesheet" href="resources/css/newton/context-menu.css"> --> <!-- <link rel="stylesheet" href="resources/css/newton/context-menu.css"> -->
<link rel="stylesheet" href="resources/css/newton/main.css"> <link rel="stylesheet" href="resources/css/newton/main.css"/>
<link rel="stylesheet" href="resources/css/newton/overrides.css"> <link rel="stylesheet" href="resources/css/newton/overrides.css"/>
<link rel="stylesheet" href="resources/css/newton/ace-overrides.css"/>
</head> </head>
<body> <body>
@ -100,15 +101,21 @@
<!-- Template Tags... --> <!-- Template Tags... -->
<template id="search-replace-template"> <template id="search-replace-template">
<!-- Bootstrap CSS --> <!-- Bootstrap CSS -->
<link rel="stylesheet" href="resources/css/libs/bootstrap5/bootstrap.min.css"> <link rel="stylesheet" href="resources/css/libs/bootstrap5/bootstrap.min.css"/>
<link rel="stylesheet" href="resources/css/libs/bootstrap-icons/bootstrap-icons.css"> <link rel="stylesheet" href="resources/css/libs/bootstrap-icons/bootstrap-icons.css"/>
<!-- Site CSS --> <!-- Site CSS -->
<!-- <link rel="stylesheet" href="resources/css/newton/context-menu.css"> --> <!-- <link rel="stylesheet" href="resources/css/newton/context-menu.css"> -->
<link rel="stylesheet" href="resources/css/newton/main.css"> <link rel="stylesheet" href="resources/css/newton/main.css"/>
<link rel="stylesheet" href="resources/css/newton/overrides.css"> <link rel="stylesheet" href="resources/css/newton/overrides.css"/>
<link rel="stylesheet" href="resources/css/newton/ace-overrides.css"/>
<style> <style>
.search-replace {
border-color: rgba(249, 148, 6, 0.74) !important;
border-style: solid !important;
border-width: 1px !important;
}
</style> </style>
<section> <section>
<div id="search-replace" class="row"> <div id="search-replace" class="row">

View File

@ -0,0 +1,90 @@
/* TAGS */
/* IDs */
#ace_settingsmenu, #kbshortcutmenu {
background-color: rgba(0, 0, 0, 0.0);
color: rgba(255, 255, 255, 1.0);
box-shadow: -5px 4px 5px rgba(249, 148, 6, 0.74);
padding: 1em 0.5em 2em 1em;
overflow: auto;
position: absolute;
margin: 0;
bottom: 0;
right: 0;
top: 0;
z-index: 9991;
cursor: default;
}
/* CLASSES */
.ace_editor.ace_autocomplete {
width: 300px;
z-index: 200000;
border: 1px lightgray solid;
position: fixed;
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
line-height: 1.4;
background-color: rgba(0, 0, 0, 0.0);
color: rgba(255, 255, 255, 1.0);
}
.ace_status-indicator {
color: gray;
position: absolute;
right: 0;
border-left: 1px solid;
}
.ace_prompt_container {
max-width: 603px;
width: 100%;
margin: 20px auto;
padding: 3px;
background: rgba(0, 0, 0, 0);
border-radius: 2px;
box-shadow: 0px 2px 3px 0px #555;
}
.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
/* background-color: #CAD6FA; */
z-index: 1;
}
/*.ace_prompt_container {*/
/* max-width: 603px;*/
/* width: 100%;*/
/* margin: 20px auto;*/
/* padding: 3px;*/
/* background: rgba(0, 0, 0, 0) !important;*/
/* border-radius: 2px;*/
/* box-shadow: 0px 2px 3px 0px #555;*/
/*}*/
.ace-tm,
.ace-tm:focus,
.ace-tm::selected {
background-color: rgba(242, 133, 0, 0.16) !important;
color: rgba(0, 0, 0, 1.0);
border: 1px lightgray solid;
}
.ace_selected {
background-color: rgba(181, 168, 153, 0.34) !important;
color: rgba(0, 0, 0, 1);
}
.ace_marker-layer .ace_selected-word {
background-color: rgba(242, 133, 0, 0.74);
color: rgba(255, 255, 255, 1.0);
}
/*.ace_marker-layer .ace_highlight-word,*/
/*.ace_marker-layer .ace_highlight-marker {*/
/* background-color: rgba(255, 0, 0, 0.74);*/
/*}*/

View File

@ -84,13 +84,6 @@
margin-bottom: -200px; margin-bottom: -200px;
} }
.ace_status-indicator {
color: gray;
position: absolute;
right: 0;
border-left: 1px solid;
}
.nav-tabs { .nav-tabs {
display: list-item; display: list-item;
overflow: auto; overflow: auto;
@ -188,4 +181,4 @@
/* Other message text colors */ /* Other message text colors */
.error { color: rgb(170, 18, 18); } .error { color: rgb(170, 18, 18); }
.warning { color: rgb(255, 168, 0); } .warning { color: rgb(255, 168, 0); }
.success { color: rgb(136, 204, 39); } .success { color: rgb(136, 204, 39); }

View File

@ -26,20 +26,6 @@ input.form-control::placeholder {
/* IDs */ /* IDs */
#ace_settingsmenu, #kbshortcutmenu {
background-color: rgba(0, 0, 0, 0.0);
color: rgba(255, 255, 255, 1.0);
box-shadow: -5px 4px 5px rgba(249, 148, 6, 0.74);
padding: 1em 0.5em 2em 1em;
overflow: auto;
position: absolute;
margin: 0;
bottom: 0;
right: 0;
top: 0;
z-index: 9991;
cursor: default;
}
/* CLASSES */ /* CLASSES */
@ -59,14 +45,3 @@ input.form-control::placeholder {
border-color: rgba(249, 148, 6, 0.74); border-color: rgba(249, 148, 6, 0.74);
} }
.ace_marker-layer .ace_selected-word {
background-color: rgba(242, 133, 0, 0.74);
color: rgba(255, 255, 255, 1.0);
}
/*.ace_marker-layer .ace_highlight-word,*/
/*.ace_marker-layer .ace_highlight-marker {*/
/* background-color: rgba(255, 0, 0, 0.74);*/
/*}*/

View File

@ -175,12 +175,6 @@ class InputCheckboxContainer extends HTMLElement {
} }
} }
const QueryState = {
Searching: 0,
SearchSuccess: 1,
SearchFail: 2
}
class SearchReplaceContainer extends HTMLElement { class SearchReplaceContainer extends HTMLElement {
constructor() { constructor() {
@ -204,11 +198,11 @@ class SearchReplaceContainer extends HTMLElement {
let elm = this.shadowRoot.getElementById("find-entry"); let elm = this.shadowRoot.getElementById("find-entry");
elm.addEventListener("keyup", (eve) => { elm.addEventListener("keydown", (eve) => {
if (eve.key === "Enter") { if (eve.key === "Enter") {
let elm = this.shadowRoot.getElementById("find-btn"); let elm = this.shadowRoot.getElementById("find-btn");
elm.click(); elm.click();
return return;
} }
let elm = this.shadowRoot.getElementById("find-all-btn"); let elm = this.shadowRoot.getElementById("find-all-btn");
@ -249,7 +243,7 @@ class SearchReplaceContainer extends HTMLElement {
elm.classList.add("btn-dark"); elm.classList.add("btn-dark");
} else { } else {
elm.classList.add("btn-info"); elm.classList.add("btn-info");
elm.classList.remove("btn-dark") elm.classList.remove("btn-dark");
} }
this.setFindOptionsLbl(); this.setFindOptionsLbl();
@ -291,7 +285,7 @@ class SearchReplaceContainer extends HTMLElement {
editor.findNext(); editor.findNext();
} }
findAllEntries(query = null, isBackwwards = true, isWrap = true, range = null) { findAllEntries(query = null, isBackwwards = false, isWrap = true, range = null) {
this.updateStyle(QueryState.SearchSuccess); this.updateStyle(QueryState.SearchSuccess);
if (query === "") { if (query === "") {
this.shadowRoot.getElementById("find-status-lbl").innerText = "Find in current buffer"; this.shadowRoot.getElementById("find-status-lbl").innerText = "Find in current buffer";
@ -302,8 +296,8 @@ class SearchReplaceContainer extends HTMLElement {
} }
let totalCount = editor.findAll(query, { let totalCount = editor.findAll(query, {
backwards: isBackwwards === "True" ? true : false, backwards: isBackwwards,
wrap: isWrap === "True" ? true : false, wrap: isWrap,
caseSensitive: this.isMatchCase(), caseSensitive: this.isMatchCase(),
wholeWord: this.isUseWholeWord(), wholeWord: this.isUseWholeWord(),
regExp: this.isUseRegex(), regExp: this.isUseRegex(),
@ -332,10 +326,10 @@ class SearchReplaceContainer extends HTMLElement {
} }
} }
findEntry(query = null, isBackwwards = true, isWrap = true, range = null) { findEntry(query = null, isBackwwards = false, isWrap = true, range = null) {
let result = editor.find(query, { let result = editor.find(query, {
backwards: isBackwwards === "True" ? true : false, backwards: isBackwwards,
wrap: isWrap === "True" ? true : false, wrap: isWrap,
caseSensitive: this.isMatchCase(), caseSensitive: this.isMatchCase(),
wholeWord: this.isUseWholeWord(), wholeWord: this.isUseWholeWord(),
regExp: this.isUseRegex(), regExp: this.isUseRegex(),
@ -379,9 +373,9 @@ class SearchReplaceContainer extends HTMLElement {
updateStyle(state) { updateStyle(state) {
let elm = this.shadowRoot.getElementById("find-entry"); let elm = this.shadowRoot.getElementById("find-entry");
elm.classList.remove("searching") elm.classList.remove("searching");
elm.classList.remove("search-success") elm.classList.remove("search-success");
elm.classList.remove("search-fail") elm.classList.remove("search-fail");
if (state === 0) if (state === 0)
elm.classList.add("searching"); elm.classList.add("searching");

View File

@ -4,19 +4,25 @@ const messenger = (window.webkit) ? window.webkit.messageHandlers : (message) =
const EDITOR_OPTS = { const EDITOR_OPTS = {
printMarginColumn: 80, printMarginColumn: 80,
enableBasicAutocompletion: true, enableBasicAutocompletion: true,
enableInlineAutocompletion: true, enableInlineAutocompletion: true,
enableSnippets: true, enableSnippets: true,
enableLiveAutocompletion: true, enableLiveAutocompletion: true,
highlightActiveLine: true, liveAutocompletionDelay: 10,
useSoftTabs: true, liveAutocompletionThreshold: 2,
tabSize: 4, highlightActiveLine: true,
tooltipFollowsMouse: true, tabSize: 4,
useWrapMode: false, useSoftTabs: true,
scrollPastEnd: 0.5, useElasticTabstops: true,
mergeUndoDeltas: false tooltipFollowsMouse: true,
} useWrapMode: false,
scrollPastEnd: 0.5,
mergeUndoDeltas: false,
showGutter: true,
customScrollbar: true,
navigateWithinSoftTabs: true
};
const BASE_LINK = `${window.location.href}resources/js/libs/ace_editor/lsp`; const BASE_LINK = `${window.location.href}resources/js/libs/ace_editor/lsp`;
@ -41,4 +47,11 @@ let isControlDown = false;
let queryMarkers = []; let queryMarkers = [];
let blockHigherNewtonEvePropigation = false; let blockHigherNewtonEvePropigation = false;
const QueryState = {
Searching: 0,
SearchSuccess: 1,
SearchFail: 2
};

View File

@ -17,8 +17,12 @@ const editorCommands = [
editor.showKeyboardShortcuts(); editor.showKeyboardShortcuts();
}) })
} }
}, {
name: "openCommandPalette2",
bindKey: {linux: "Command-Shift-/|F1", win: "Ctrl-Shift-/|F1"},
exec: function(editor) {
editor.execCommand("openCommandPalette");
}
}, { }, {
name: "showLSPManager", name: "showLSPManager",
bindKey: {win: "ctrl-m", mac: "command-m"}, bindKey: {win: "ctrl-m", mac: "command-m"},
@ -41,7 +45,6 @@ const editorCommands = [
sendMessage("open_file", "", "", fpath, ""); sendMessage("open_file", "", "", fpath, "");
}, },
readOnly: true readOnly: true
}, { }, {
name: "saveSession", name: "saveSession",
bindKey: {win: "ctrl-s", mac: "ctrl-s"}, bindKey: {win: "ctrl-s", mac: "ctrl-s"},
@ -70,6 +73,13 @@ const editorCommands = [
toggleLineHighlight(); toggleLineHighlight();
}, },
readOnly: true readOnly: true
}, {
name: "gotoDefinition",
bindKey: {win: "ctrl-g", mac: "ctrl-g"},
exec: function(editor) {
console.log("Goto stub...");
},
readOnly: true
}, { }, {
name: "movelinesUp", name: "movelinesUp",
bindKey: {win: "ctrl-up", mac: "ctrl-up"}, bindKey: {win: "ctrl-up", mac: "ctrl-up"},
@ -121,5 +131,4 @@ const editorCommands = [
readOnly: true readOnly: true
} }
]; ];

View File

@ -15,6 +15,7 @@ const loadPreviewEditor = () => {
const loadEditor = () => { const loadEditor = () => {
ace.require("ace/ext/language_tools"); ace.require("ace/ext/language_tools");
ace.require("ace-linters/language-client"); ace.require("ace-linters/language-client");
ace.require("ace/ext/elastic_tabstops_lite");
editor = ace.edit("editor"); editor = ace.edit("editor");
// Note: https://github.com/ajaxorg/ace/wiki/Configuring-Ace // Note: https://github.com/ajaxorg/ace/wiki/Configuring-Ace

View File

@ -6,7 +6,7 @@
"socket": "ws://127.0.0.1:3030/?name=shell", "socket": "ws://127.0.0.1:3030/?name=shell",
"initialization-options": {} "initialization-options": {}
}, },
"python": { "python": {
"info": "https://github.com/python-lsp/python-lsp-server", "info": "https://github.com/python-lsp/python-lsp-server",
"alt-command": "pylsp --ws --port 3030", "alt-command": "pylsp --ws --port 3030",
"command": "lsp-ws-proxy --listen 3030 -- pylsp", "command": "lsp-ws-proxy --listen 3030 -- pylsp",
@ -21,6 +21,28 @@
] ]
} }
}, },
"python_bad_config": {
"info": "https://github.com/python-lsp/python-lsp-server",
"alt-command": "pylsp --ws --port 3030",
"command": "lsp-ws-proxy --listen 3030 -- pylsp",
"socket": "ws://127.0.0.1:3030/?name=pylsp",
"initialization-options": {
"pylsp.plugins.ruff": true,
"pylsp.plugins.pylsp_rope.rename": true,
"pylsp.plugins.rope_rename.enabled": false,
"pylsp.plugins.rope_autoimport.enabled": true,
"pylsp.plugins.rope_completion.enabled": false,
"pylsp.plugins.rope_completion.eager": false,
"pylsp.plugins.jedi_rename.enabled": false,
"pylsp.plugins.jedi_completion.enabled": true,
"pylsp.plugins.jedi_completion.include_class_objects": false,
"pylsp.plugins.jedi_completion.include_function_objects": false,
"pylsp.plugins.jedi_completion.fuzzy": true,
"pylsp.plugins.jedi.extra_paths": [
"/home/abaddon/Portable_Apps/py-venvs/lsp_bridge-venv/venv/lib/python3.10/site-packages/gi-stubs"
]
}
},
"python3": { "python3": {
"info": "https://pypi.org/project/jedi-language-server/", "info": "https://pypi.org/project/jedi-language-server/",
"alt-command": "jedi-language-server", "alt-command": "jedi-language-server",
@ -68,5 +90,12 @@
"command": "lsp-ws-proxy --listen 3030 -- java-language-server", "command": "lsp-ws-proxy --listen 3030 -- java-language-server",
"socket": "ws://127.0.0.1:3030/?name=java-language-server", "socket": "ws://127.0.0.1:3030/?name=java-language-server",
"initialization-options": {} "initialization-options": {}
},
"go": {
"info": "https://pkg.go.dev/golang.org/x/tools/gopls#section-readme",
"alt-command": "gopls",
"command": "lsp-ws-proxy --listen 3030 -- gopls",
"socket": "ws://127.0.0.1:3030/?name=gopls",
"initialization-options": {}
} }
} }