Compare commits
2 Commits
b20702928a
...
e37d291e1d
| Author | SHA1 | Date | |
|---|---|---|---|
|
e37d291e1d
|
|||
|
78bf2d666d
|
@@ -72,7 +72,7 @@ The following lsp's are supported and can be installed anywhere in your `$PATH`<
|
||||
* [fish-lsp](https://github.com/ndonfris/fish-lsp)
|
||||
* [gopls](https://pkg.go.dev/golang.org/x/tools/gopls)
|
||||
* [haskell-language-server](https://github.com/haskell/haskell-language-server)
|
||||
* [emmet-ls](https://github.com/aca/emmet-ls) *Autocompletion for emmet works but doesn't show popup correctly for now, use ctrl+\\ to run after writing emmet code*
|
||||
* [emmet-language-server](https://github.com/olrtg/emmet-language-server)
|
||||
* [typescript-language-server](https://github.com/typescript-language-server/typescript-language-server)
|
||||
* [lua-language-server](https://github.com/LuaLS/lua-language-server)
|
||||
* [pyright-langserver](https://github.com/microsoft/pyright)
|
||||
@@ -292,6 +292,7 @@ Activated by `:` or `;`.
|
||||
- diagnostics
|
||||
- autocompletion
|
||||
- hover docs (with markdown support)
|
||||
- formatting *(very few lsp's support this - try to configure a few more which can but need configuration and for others need to add support for external formatters)*
|
||||
- A list of all supported lsp's can be found [here](#lsps).
|
||||
|
||||
**A lot lot more to come**
|
||||
|
||||
1
TODO.md
1
TODO.md
@@ -21,6 +21,7 @@ Copyright 2025 Syed Daanish
|
||||
- [ ] For `"insertTextFormat": 2` in `clangd` and similar use only the last word in the signature when replacing
|
||||
- [ ] Keep a list of words in the current buffer. (for auto completion) (maybe?)
|
||||
- [ ] Add ecma to js and make tsx
|
||||
- [ ] Add formatting for files whose lsp doesnt.
|
||||
- [ ] Switch to like `RapidJSON` ro something more basic but faster than rn
|
||||
- also decrease use of `std::string` so much in ui stuff and lsp and warnings etc.
|
||||
- [ ] Add lsp jumping support for goto definition, hover etc.
|
||||
|
||||
@@ -75,9 +75,9 @@ static const std::unordered_map<uint8_t, LSP> kLsps = {
|
||||
nullptr,
|
||||
}}},
|
||||
{10,
|
||||
{"emmet-ls",
|
||||
{"emmet-language-server",
|
||||
{
|
||||
"emmet-ls",
|
||||
"emmet-language-server",
|
||||
"--stdio",
|
||||
nullptr,
|
||||
}}},
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<s>strikethrough</s>, <del>deleted text</del>, <code>inline code</code>,
|
||||
<kbd>keyboard input</kbd>.
|
||||
</p>
|
||||
|
||||
|
||||
<a href="https://hello.world"></a>
|
||||
|
||||
<!-- Lit-html / template interpolation -->
|
||||
|
||||
@@ -52,11 +52,11 @@ void completion_filter(Editor *editor) {
|
||||
void completion_request(Editor *editor) {
|
||||
Coord hook = editor->cursor;
|
||||
word_boundaries(editor, editor->cursor, &hook.col, nullptr, nullptr, nullptr);
|
||||
editor->completion.hook = hook;
|
||||
editor->completion.active = true;
|
||||
editor->completion.items.clear();
|
||||
editor->completion.visible.clear();
|
||||
editor->completion.select = 0;
|
||||
editor->completion.hook = hook;
|
||||
LSPPending *pending = new LSPPending();
|
||||
pending->editor = editor;
|
||||
pending->method = "textDocument/completion";
|
||||
@@ -94,6 +94,7 @@ void completion_request(Editor *editor) {
|
||||
}
|
||||
}
|
||||
session.items.reserve(items_json.size() + 1);
|
||||
session.visible.reserve(items_json.size() + 1);
|
||||
for (auto &item_json : items_json) {
|
||||
CompletionItem item;
|
||||
item.original = item_json;
|
||||
@@ -190,8 +191,8 @@ void completion_request(Editor *editor) {
|
||||
if (c.is_string() && c.get<std::string>().size() == 1)
|
||||
item.end_chars.push_back(c.get<std::string>()[0]);
|
||||
session.items.push_back(std::move(item));
|
||||
session.visible.push_back(session.items.size() - 1);
|
||||
}
|
||||
completion_filter(editor);
|
||||
session.box.hidden = false;
|
||||
session.box.render_update();
|
||||
};
|
||||
@@ -268,7 +269,7 @@ void handle_completion(Editor *editor, KeyEvent event) {
|
||||
completion_request(editor);
|
||||
}
|
||||
} else if (ch == CTRL('\\')) {
|
||||
if (editor->completion.active) {
|
||||
if (editor->completion.active && editor->completion.visible.size()) {
|
||||
complete_accept(editor);
|
||||
} else {
|
||||
editor->completion.trigger = 1;
|
||||
@@ -280,7 +281,7 @@ void handle_completion(Editor *editor, KeyEvent event) {
|
||||
} else if (ch == CTRL('o')) {
|
||||
if (editor->completion.active)
|
||||
complete_prev(editor);
|
||||
} else if (ch == 0x7F || ch == 0x08) {
|
||||
} else if (ch == 0x7F || ch == 0x08 || ch == CTRL('W')) {
|
||||
if (editor->completion.active) {
|
||||
if (editor->completion.complete) {
|
||||
if (editor->cursor <= editor->completion.hook)
|
||||
@@ -288,7 +289,10 @@ void handle_completion(Editor *editor, KeyEvent event) {
|
||||
else
|
||||
completion_filter(editor);
|
||||
} else {
|
||||
completion_request(editor);
|
||||
if (editor->cursor <= editor->completion.hook)
|
||||
editor->completion.active = false;
|
||||
else
|
||||
completion_request(editor);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user