Compare commits
3 Commits
cdddb35d7c
...
9ed640c88e
| Author | SHA1 | Date | |
|---|---|---|---|
|
9ed640c88e
|
|||
|
bb87ae32f9
|
|||
|
f2f176e8c8
|
170
TODO.md
170
TODO.md
@@ -2,57 +2,119 @@ Copyright 2025 Syed Daanish
|
|||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
- [ ] Check why fish is behaving soo off with completions filtering
|
### Critical Fixes
|
||||||
- [ ] Dont filter case sensitive.
|
|
||||||
- [ ] Normalize completions edits if local filtering is used
|
* [ ] **Critical Crash:** Fix bug where closing immediately while LSP is still loading hangs and then segfaults (especially on slow ones like fish-lsp).
|
||||||
- [ ] Capture ctrl+h,l for scrolling documentation
|
* [ ] **Navigation Bug:** Fix bug where `Alt+Up` at EOF adds an extra line.
|
||||||
- [ ] Allow completion list to be scrolled up and down and show only x max at a time
|
* [ ] **LSP Bug:** Check why `fish-lsp` is behaving so off with completions filtering.
|
||||||
- [ ] Do not recompute word under cursor if not changed
|
* [ ] **File IO:** Normalize/validate unicode on file open (enforce UTF-8, handle other types gracefully).
|
||||||
- [ ] Finish autocomplete box style functions.
|
|
||||||
- [ ] Add status bar & RUNNER mode
|
|
||||||
- [ ] Get code context from tree-sitter
|
### Core Editing Mechanics
|
||||||
- [ ] Maybe hide boxes in !`normal` mode
|
|
||||||
- [ ] expand color regex to match css colors if in css file
|
* [ ] **Undo/Redo:** Add support for undo/redo history.
|
||||||
- [ ] Fix indentation logic - tree-sitter indents too if possible
|
* [ ] **Indentation Engine (Major Task):**
|
||||||
- Make it work by one getting the identation used in a file by first checking if it has any line with 2 or more spaces then the least one is set to be the indent or if it is tabs then tabs but if there are none then use a table of file type to its indentation or use 2 spaces as default. store this info as `1 = tab` and `2 or more = those many spaces`.
|
* **Startup:**
|
||||||
- Use this when indenting and unindenting. And also when getting the identation of a line.
|
1. Scan file: Check for lines with 2+ spaces. Least count = indent. If tabs, use tabs.
|
||||||
- Also indent when going immediately to newline should follow indent of previous line regardless of file default.
|
2. Fallback: Use table of file types or default to 2 spaces.
|
||||||
- [ ] Fix bug where closing immediately while lsp is loading hangs and then segfaults.
|
3. Store as: `1 = tab`, `2+ = n spaces`.
|
||||||
- [ ] For `"insertTextFormat": 2` in `clangd` and similar use only the last word in the signature when replacing
|
4. Apply: Use this for indent/unindent actions.
|
||||||
- [ ] Keep a list of words in the current buffer. (for auto completion) (maybe?)
|
5. Newline: Follow indent of previous line immediately (ignore default).
|
||||||
- [ ] Add ecma to js and make tsx
|
* **Indent/Unindent:**
|
||||||
- [ ] Add formatting for files whose lsp doesnt.
|
* Add support for indent/unindent actions.
|
||||||
- [ ] Switch to like `RapidJSON` ro something more basic but faster than rn
|
* that use indentation of previous line that is not comment or string or whitespace/blank.
|
||||||
- also decrease use of `std::string` so much in ui stuff and lsp and warnings etc.
|
* and try auto indent one level extra if previous line ends with colon or bracket start.
|
||||||
- [ ] Add lsp jumping support for goto definition, hover etc.
|
* and dedent one level extra if previous line ends with bracket end.
|
||||||
- [ ] Add lsp rename support for renaming a symbol. (also see what tree-sitter can do here)
|
* **Newline:** Add support for newline actions similar to indent.
|
||||||
- [ ] Check into more lsp stuff i can add.
|
|
||||||
- [ ] Add codeium/copilot support for auto-completion (uses the VAI virtual text) as a test phase.
|
* [ ] **Tree-sitter Indent:** Attempt to allow Tree-sitter to handle indentation if possible.
|
||||||
- [ ] Add a whitespace highlighter (nerd font). for spaces and tabs at start/end of line. not as virtual but instead at render time.
|
|
||||||
- [ ] Once renderer is proven to work well (i.e. redo this commit) merge `experimental` branch into `main`. commit `43f443e` on `experimental`.
|
* [ ] **Scrolling:** Add logic where selecting at the end of the screen scrolls down (and vice versa).
|
||||||
- [ ] Add snippets from wherever i get them. (like luasnip or vsnip)
|
* *Implementation:* Update `main.cc` to send drag events to the selected editor.
|
||||||
- [ ] Add this thing where select at end of screen scrolls down. (and vice versa)
|
|
||||||
- Can be acheived by updating `main.cc` to send drag events to the selected editor instead of just under cursor.
|
* [ ] **Documentation UI:** Capture `Ctrl+h` / `Ctrl+l` for scrolling documentation windows.
|
||||||
- Then a drag event above or below will scroll the selected editor.
|
|
||||||
- [ ] Add support for virtual cursor where edits apply at all the places.
|
|
||||||
- [ ] Add alt + click to set multiple cursors.
|
### UX
|
||||||
- [ ] Add search / replace along with search / virtual cursors are searched pos.
|
|
||||||
- Allow using perl directly for replace maybe? and others with my dfa?
|
* [ ] **Editor word highlighter:** Do not recompute word under cursor if not changed.
|
||||||
- or add searcher that supports $1 $2 etc. (capture groups)
|
|
||||||
- [ ] Add support for undo/redo.
|
* [ ] **Completion Filtering:**
|
||||||
- [ ] Add splash screen / minigame jumping.
|
* [ ] Stop filtering case-sensitive.
|
||||||
- [ ] Normalize / validate unicode on file open. so use utf8 purely and fix other types of files
|
* [ ] Normalize completion edits if local filtering is used.
|
||||||
- [ ] Add git stuff.
|
|
||||||
- [ ] Add SQL support. (viewer and basic editor)
|
* [ ] **UI Refinement:**
|
||||||
- [ ] Add color picker/palette for hex or other css colors.
|
* [ ] Allow completion list to be scrolled; show only `x` max items.
|
||||||
- [ ] Fix bug where alt+up at eof adds extra line.
|
* [ ] Finish autocomplete box style functions.
|
||||||
- [ ] Think about how i would keep fold states sensical if i added code prettying/formatting.
|
|
||||||
- [ ] Use tree-sitter to get the node path of the current node under cursor and add an indicator bar.
|
* [ ] **LSP Features:**
|
||||||
- (possibly with a picker to jump to any node)
|
* [ ] Add LSP jumping support (Go to Definition, Hover).
|
||||||
- [ ] Add the highlight of block edges when cursor is on a bracket (or in). (prolly from lsp)
|
* [ ] Add LSP rename support.
|
||||||
- [ ] Add this thing where selection double click on a bracket selects whole block.
|
* [ ] Handle snippets properly in autocomplete: use only the last word in signature when replacing and set cursor to the first one.
|
||||||
- (only on the first time) and sets mode to `WORD`.
|
|
||||||
- [ ] Redo cpp/c/h scm file . also pretty much all of them do manually
|
* [ ] **Basic Autocomplete:** Keep a list of words in the current buffer for non-LSP fallback.
|
||||||
- [ ] Try making `lua-typed` and man pages `tree-sitter` grammar.
|
* [ ] **Language Support:**
|
||||||
- [ ] Redo folding system and its relation to move_line_* functions. (Currently its a mess)
|
* [ ] Add ECMA to JS and make TSX support.
|
||||||
- [ ] Make whole thing event driven and not clock driven.
|
* [ ] Add formatting for files where LSP doesn't provide it.
|
||||||
|
* [ ] Redo grammar files properly (especially cpp).
|
||||||
|
|
||||||
|
|
||||||
|
### Major Features
|
||||||
|
|
||||||
|
* [ ] **Search & Replace:**
|
||||||
|
* [ ] Add Search/Replace UI.
|
||||||
|
* [ ] Support capture groups (`$1`, `$2`) or allow Perl regex directly.
|
||||||
|
* [ ] Ensure virtual cursors are included in search positions.
|
||||||
|
|
||||||
|
* [ ] **Multi-Cursor:**
|
||||||
|
* [ ] Add virtual cursor support (edits apply to all locations).
|
||||||
|
* [ ] Add `Alt+Click` to set multiple cursors.
|
||||||
|
* [ ] Allow search and place cursor at all matches.
|
||||||
|
|
||||||
|
* [ ] **Block Selection:**
|
||||||
|
* [ ] Double-clicking a bracket selects the whole block (first time only) and sets mode to `WORD`.
|
||||||
|
|
||||||
|
* [ ] **Tree-sitter Context:**
|
||||||
|
* [ ] Get code context from Tree-sitter.
|
||||||
|
* [ ] Get node path of current cursor and add indicator bar (breadcrumbs).
|
||||||
|
* [ ] Highlight block edges when cursor is on/in a bracket.
|
||||||
|
|
||||||
|
|
||||||
|
### Visuals, UI & Extensions?
|
||||||
|
|
||||||
|
*Focus: Aesthetics and external integrations.*
|
||||||
|
|
||||||
|
* [ ] **Status Bar:** Complete status bar and command runner.
|
||||||
|
|
||||||
|
* [ ] **Visual Aids:**
|
||||||
|
* [ ] Expand color regex to match CSS colors in CSS files.
|
||||||
|
* [ ] Add color picker/palette.
|
||||||
|
|
||||||
|
* [ ] **Git:** Add Git integration (status, diffs).
|
||||||
|
* [ ] **AI/Snippets:**
|
||||||
|
* [ ] Add snippets support (LuaSnip/VSnip style).
|
||||||
|
* [ ] Add Codeium/Copilot support (using VAI virtual text) as a test phase.
|
||||||
|
|
||||||
|
* [ ] **SQL:** Add SQL support (Viewer and Basic Editor).
|
||||||
|
* [ ] **Prolly?:** Add Splash Screen / Minigame.
|
||||||
|
|
||||||
|
|
||||||
|
### Optimizations & Fluff
|
||||||
|
|
||||||
|
* [ ] **Event Loop:**
|
||||||
|
* [ ] Make the whole engine event-driven rather than clock-driven.
|
||||||
|
* [ ] Mybe keep background thread with dirty flag.
|
||||||
|
* [ ] But merge input and render into a single loop that only renders when input affects render or background thread needs refresh and try to couple multiple renders.
|
||||||
|
* [ ] LSP and inputs should be blocking (lsp on its fd) and inputs in io/input.cc
|
||||||
|
|
||||||
|
* [ ] **Performance:**
|
||||||
|
* [ ] Switch JSON parser to `RapidJSON` (or similar high-performance lib).
|
||||||
|
* [ ] Decrease usage of `std::string` in UI, LSP, and warnings.
|
||||||
|
|
||||||
|
* [ ] **Folding:** Redo folding system and its relation to `move_line_*` functions.
|
||||||
|
|
||||||
|
* [ ] **Grammars:**
|
||||||
|
* [ ] Manually add redo SCM files (especially cpp/c/h).
|
||||||
|
* [ ] Create `lua-typed` and `man pages` Tree-sitter grammars.
|
||||||
|
|
||||||
|
* [ ] **Repo Maintenance:** Once renderer is proven check commit `43f443e`.
|
||||||
|
|||||||
@@ -140,3 +140,4 @@ log INFO "You typed: $user_input"
|
|||||||
|
|
||||||
# End marker
|
# End marker
|
||||||
log INFO "Script finished (version $VERSION)"
|
log INFO "Script finished (version $VERSION)"
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ void completion_request(Editor *editor) {
|
|||||||
Coord hook = editor->cursor;
|
Coord hook = editor->cursor;
|
||||||
word_boundaries(editor, editor->cursor, &hook.col, nullptr, nullptr, nullptr);
|
word_boundaries(editor, editor->cursor, &hook.col, nullptr, nullptr, nullptr);
|
||||||
editor->completion.hook = hook;
|
editor->completion.hook = hook;
|
||||||
editor->completion.active = true;
|
editor->completion.complete = false;
|
||||||
|
editor->completion.active = false;
|
||||||
editor->completion.items.clear();
|
editor->completion.items.clear();
|
||||||
editor->completion.visible.clear();
|
editor->completion.visible.clear();
|
||||||
editor->completion.select = 0;
|
editor->completion.select = 0;
|
||||||
@@ -71,9 +72,15 @@ void completion_request(Editor *editor) {
|
|||||||
if (result.is_array()) {
|
if (result.is_array()) {
|
||||||
items_json = result.get<std::vector<json>>();
|
items_json = result.get<std::vector<json>>();
|
||||||
session.complete = true;
|
session.complete = true;
|
||||||
|
if (items_json.empty())
|
||||||
|
return;
|
||||||
|
editor->completion.active = true;
|
||||||
} else if (result.is_object() && result.contains("items")) {
|
} else if (result.is_object() && result.contains("items")) {
|
||||||
auto &list = result;
|
auto &list = result;
|
||||||
items_json = list["items"].get<std::vector<json>>();
|
items_json = list["items"].get<std::vector<json>>();
|
||||||
|
if (items_json.empty())
|
||||||
|
return;
|
||||||
|
editor->completion.active = true;
|
||||||
session.complete = !list.value("isIncomplete", false);
|
session.complete = !list.value("isIncomplete", false);
|
||||||
if (list.contains("itemDefaults") && list["itemDefaults"].is_object()) {
|
if (list.contains("itemDefaults") && list["itemDefaults"].is_object()) {
|
||||||
auto &defs = list["itemDefaults"];
|
auto &defs = list["itemDefaults"];
|
||||||
@@ -246,8 +253,7 @@ void handle_completion(Editor *editor, KeyEvent event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (editor->completion.items.empty())
|
if (!editor->completion.items.empty()) {
|
||||||
return;
|
|
||||||
const auto &item = editor->completion.items[editor->completion.select];
|
const auto &item = editor->completion.items[editor->completion.select];
|
||||||
const std::vector<char> &end_chars =
|
const std::vector<char> &end_chars =
|
||||||
item.end_chars.empty() ? editor->lsp->end_chars : item.end_chars;
|
item.end_chars.empty() ? editor->lsp->end_chars : item.end_chars;
|
||||||
@@ -257,6 +263,7 @@ void handle_completion(Editor *editor, KeyEvent event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
|
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
|
||||||
(ch >= '0' && ch <= '9') || ch == '_') {
|
(ch >= '0' && ch <= '9') || ch == '_') {
|
||||||
if (editor->completion.active) {
|
if (editor->completion.active) {
|
||||||
@@ -269,7 +276,7 @@ void handle_completion(Editor *editor, KeyEvent event) {
|
|||||||
completion_request(editor);
|
completion_request(editor);
|
||||||
}
|
}
|
||||||
} else if (ch == CTRL('\\')) {
|
} else if (ch == CTRL('\\')) {
|
||||||
if (editor->completion.active && editor->completion.visible.size()) {
|
if (editor->completion.active && !editor->completion.visible.empty()) {
|
||||||
complete_accept(editor);
|
complete_accept(editor);
|
||||||
} else {
|
} else {
|
||||||
editor->completion.trigger = 1;
|
editor->completion.trigger = 1;
|
||||||
@@ -294,6 +301,9 @@ void handle_completion(Editor *editor, KeyEvent event) {
|
|||||||
else
|
else
|
||||||
completion_request(editor);
|
completion_request(editor);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
editor->completion.trigger = 3;
|
||||||
|
completion_request(editor);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
editor->completion.active = false;
|
editor->completion.active = false;
|
||||||
@@ -362,7 +372,21 @@ void complete_accept(Editor *editor) {
|
|||||||
if (!editor->completion.active || editor->completion.box.hidden)
|
if (!editor->completion.active || editor->completion.box.hidden)
|
||||||
return;
|
return;
|
||||||
auto &item = editor->completion.items[editor->completion.select];
|
auto &item = editor->completion.items[editor->completion.select];
|
||||||
// TODO: support snippets here
|
// TODO: support snippets here maybe?
|
||||||
|
int delta_col = 0;
|
||||||
|
TextEdit &e = item.edits[0];
|
||||||
|
if (e.end.row == editor->cursor.row) {
|
||||||
|
delta_col = editor->cursor.col - e.end.col;
|
||||||
|
e.end.col = editor->cursor.col;
|
||||||
|
for (size_t i = 1; i < item.edits.size(); ++i) {
|
||||||
|
TextEdit &e = item.edits[i];
|
||||||
|
if (e.start.row == editor->cursor.row) {
|
||||||
|
e.start.col += delta_col;
|
||||||
|
if (e.end.row == editor->cursor.row)
|
||||||
|
e.end.col += delta_col;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
apply_lsp_edits(editor, item.edits, true);
|
apply_lsp_edits(editor, item.edits, true);
|
||||||
editor->completion.active = false;
|
editor->completion.active = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ void background_lsp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void input_listener() {
|
void input_listener() {
|
||||||
|
|
||||||
while (running) {
|
while (running) {
|
||||||
KeyEvent event = throttle(1ms, read_key);
|
KeyEvent event = throttle(1ms, read_key);
|
||||||
if (event.key_type == KEY_NONE)
|
if (event.key_type == KEY_NONE)
|
||||||
@@ -131,4 +130,3 @@ int main(int argc, char *argv[]) {
|
|||||||
clear_regex_cache();
|
clear_regex_cache();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user