ki-editor / ki-editor

https://ki-editor.github.io/ki-editor/
Mozilla Public License 2.0
30 stars 0 forks source link

Failed to compile on debian Debian GNU/Linux 12 (bookworm) #1

Open sparrisable opened 9 months ago

sparrisable commented 9 months ago

I tried to comple master (65bd725edba831953d7477b3b3c24fcf5913ed86) but got the following error:

error[E0277]: the trait bound TSLanguage: Doc is not satisfied --> src/selection_mode/ast_grep.rs:6:14 6 pattern: ast_grep_core::matcher::Pattern, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait Doc is not implemented for TSLanguage

= help: the trait Doc is implemented for StrDoc<L> note: required by a bound in ast_grep_core::Pattern --> /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ast-grep-core-0.5.7/src/matcher/pattern.rs:24:23 | 24 | pub struct Pattern { | ^^^ required by this bound in Pattern

For more information about this error, try rustc --explain E0277. error: could not compile tim (bin "tim") due to previous error error: failed to compile `tim v0.1.0

I took a chance and downloaded the current master, if this is not yet ready for testing yet then I will just wait until a later version. Thanks for providing this project!

wongjiahau commented 9 months ago

Hey @sparrisable, try this:

cargo install --locked --path .

I believe it's ready for testing and more usable than my current Neovim configuration. However, I still rely on Neovim heavily because of Copilot and Fugitive.vim.

sparrisable commented 9 months ago

It works for me now, next step is just to figure out the keys and modes, thank you! There have been a lot of work been done on the existing editors. But I think the new ones, like Tim, with better fundamentals will have a good chance to surpass them.

wongjiahau commented 9 months ago

The keybindings are not fully finalized yet, but I’ll include them in the Readme for your references. Thanks for your support!

wongjiahau commented 9 months ago

The keybindings are included here

sparrisable commented 9 months ago

I have tried the keybindings and these navigation keys suits me better than what other editors use, it is great.

wongjiahau commented 9 months ago

Are there any keybindings that you find confusing or not sure what they do?

sparrisable commented 9 months ago

I am not sure on how to use the Find menu properly to search for a string a file. But it is no hurry for me, I plan to try the tim editor in the long term.

wongjiahau commented 9 months ago

I see, let me document those keybindings as well

wongjiahau commented 9 months ago

I added them under https://github.com/wongjiahau/treeman/blob/master/keybindings.md#find-menu

sparrisable commented 9 months ago

Nice, i did not realize that there where more alternatives in the find list. I had a small terminal window and I only saw the top of the list.

I actually have another question regarding the modes. When Tim starts it says NORMAL:CUSTOM, I press 'w' to get to NORMAL:WORD to navigate on words. But is the NORMAL:CUSTOM mode something that is recommended to use (how does it work in that case)?

Another thing that I was thinking about is how to use C++ with tree-sitter and clangd. I tested to add something like this to the languages.rs file (at least it compiles):

+const fn cpp() -> Language {
+    Language {
+        lsp_language_id: Some(LanguageId::new("cpp")),
+        extensions: &["cpp", "hpp", "c", "h"],
+        lsp_command: Some(LspCommand {
+            command: Command("clangd", &[]),
+            ..LspCommand::default()
+        }),
+        highlight_query: None,
+        tree_sitter_grammar_config: Some(GrammarConfig {
+            id: "cpp",
+            url: "https://github.com/tree-sitter/tree-sitter-cpp",
+            commit: "ab1065fa23a43a447bd7e619a3af90253867af24",
+            subpath: None,
+        }),
+        formatter_command: None,
+        ..Language::new()
+    }
wongjiahau commented 9 months ago

The keymap legend is actually scrollable, you can switch to that window by using ctrl+w, and then you can scroll the content using ctrl+d and ctrl+u.

Anyway, I will have to include some sort of indicator so that users will know that the content is not fully displayed.

For the tree-sitter and language server part, if it compiles then it should work already.

Similarly, I have not built the indicator for both the tree-sitter grammar and the LSP server that are currently being loaded, so there’s no wonder that you can’t tell if it works or not.

Also, there might not be syntax highlighting, because unfortunately, those highlight queries are not with the tree-sitter repos, they are however concentrated in nvim-treesitter.

wongjiahau commented 9 months ago

Regarding CUSTOM, it is not the recommended mode, it is just the default, which is not moveable, e.g. pressing n does nothing.

The recommended way is to use the syntax tree selection modes, like Top node (t), Syntax Tree (s), and *Bottom node (b), in combination with Jump (j).

My personal favorite is using Top Node or Bottom Node with Jump.

Edit: Renamed outermost node to Top Node, and Token to Bottom Node.

sparrisable commented 9 months ago

Thanks, that was great info. I will try it out.

damianoognissanti commented 8 months ago

Compiling using cargo install --locked --path . I got the error below.

...
error[E0658]: use of unstable library feature 'is_some_and'
   --> src/app.rs:656:14
    |
656 |             .is_some_and(|component| component.borrow().id() == component_id)
    |              ^^^^^^^^^^^
    |
    = note: see issue #93050 <https://github.com/rust-lang/rust/issues/93050> for more information

...

For more information about this error, try `rustc --explain E0658`.
warning: `tim` (bin "tim") generated 4 warnings
error: could not compile `tim` due to previous error; 4 warnings emitted
error: failed to compile `tim v0.1.0 (/home/damiano/treeman)`, intermediate artifacts can be found at `/home/damiano/treeman/target`

After running rustup update nightly I get this instead:

error[E0635]: unknown feature `proc_macro_span_shrink`
  --> /home/damiano/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^
damianoognissanti commented 8 months ago

After running rustup update nightly, deleting Cargo.lock, running cargo add proc-macro2 (to get version 1.0.69), running cargo install --locked --path . I get the same error as the first post:

error[E0277]: the trait bound `TSLanguage: Doc` is not satisfied
  --> src/selection_mode/ast_grep.rs:6:14
   |
6  |     pattern: ast_grep_core::matcher::Pattern<TSLanguage>,
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Doc` is not implemented for `TSLanguage`
   |
   = help: the trait `Doc` is implemented for `StrDoc<L>`
note: required by a bound in `ast_grep_core::Pattern`
  --> /home/damiano/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ast-grep-core-0.12.5/src/matcher/pattern.rs:24:23
   |
24 | pub struct Pattern<D: Doc> {
   |                       ^^^ required by this bound in `Pattern`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `tim` (bin "tim") due to previous error
error: failed to compile `tim v0.1.0 (/home/damiano/treeman)`, intermediate artifacts can be found at `/home/damiano/treeman/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
wongjiahau commented 8 months ago

@damianoognissanti Try running rustup default stable before running cargo install --locked --path .

damianoognissanti commented 8 months ago

It works! The problem was that I had multiple versions of rustc installed, so I tried to remove them all and just use rustup to get version 1.73 of rustc.