Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Probably shouldn't suggest joining a word with a following capital letter #722

Open
hippietrail opened this issue Feb 19, 2025 · 7 comments · May be fixed by #738
Open

feat: Probably shouldn't suggest joining a word with a following capital letter #722

hippietrail opened this issue Feb 19, 2025 · 7 comments · May be fixed by #738

Comments

@hippietrail
Copy link
Contributor

hippietrail commented Feb 19, 2025

In a discussion of alphabets I found this sentence:

C is gone, leaving S and K to do its job.

Harper wants to join "leaving" + "S" to "leavingS"

Image

There should probably be a heuristic for this. It would make sense if both were lower case or if both were in all caps.


And a more confusing example:
Image

@elijah-potter elijah-potter linked a pull request Feb 21, 2025 that will close this issue
@elijah-potter
Copy link
Collaborator

I've added unit tests for this, which pass. Are you still experiencing this or can we close the issue?

@hippietrail
Copy link
Contributor Author

I've added unit tests for this, which pass. Are you still experiencing this or can we close the issue?

I had to fight with git but I'm sure I got the PR branch building. Here's a screenshot from just lint in VS Code and you can see the branch in the bottom left:

Image

For this one I knew exactly which video it was so I'll attach the exact file: youtube-transcript.md

@elijah-potter
Copy link
Collaborator

It's passing that one too.

@hippietrail
Copy link
Contributor Author

It's passing that one too.

Every now and then I get the feeling something is not getting updated somehow I don't understand...

OK this was the one where I tried to follow the docs at https://writewithharper.com/docs/contributors/review and did this command: % cargo install --git https://github.com/automattic/harper --branch remove-letters harper-cli but got these errors:

error[E0308]: `match` arms have incompatible types
  --> harper-comments/src/comment_parser.rs:45:23
   |
45 |             "dart" => tree_sitter_dart::language(),
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `tree_sitter::Language`, found a different `tree_sitter::Language`
   |
note: two different versions of crate `tree_sitter` are being used; two types coming from two different versions of the same crate are different types even if they look the same
  --> /Users/hippietrail/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tree-sitter-0.20.10/binding_rust/lib.rs:43:1
   |
43 | pub struct Language(*const ffi::TSLanguage);
   | ^^^^^^^^^^^^^^^^^^^ this is the expected type `tree_sitter::Language`
   |
  ::: /Users/hippietrail/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tree-sitter-0.22.6/binding_rust/lib.rs:54:1
   |
54 | pub struct Language(*const ffi::TSLanguage);
   | ^^^^^^^^^^^^^^^^^^^ this is the found type `tree_sitter::Language`
   |
  ::: harper-comments/src/comment_parser.rs:7:5
   |
7  | use tree_sitter::Node;
   |     ----------- one version of crate `tree_sitter` used here, as a direct dependency of the current crate
...
45 |             "dart" => tree_sitter_dart::language(),
   |                       ---------------- one version of crate `tree_sitter` used here, as a dependency of crate `tree_sitter_dart`
   = help: you can use `cargo tree` to explore your dependency tree

For more information about this error, try `rustc --explain E0308`.
error: could not compile `harper-comments` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `harper-cli v0.1.0 (https://github.com/automattic/harper?branch=remove-letters#5e04b566)`, intermediate artifacts can be found at `/var/folders/k3/12zzpg7j4k347xdnnykffpd80000gn/T/cargo-install5gvzYL`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

And then tried to pull or fetch and build the PR branch using git manually, but probably failed to get the right incantations and must've still been building out-of-date code? 🫤 Suffice it to say I still don't know how to actually do it.

@elijah-potter
Copy link
Collaborator

If you get errors related to Language like that, it's because you are neglecting to add --locked to your cargo command.

@hippietrail
Copy link
Contributor Author

If you get errors related to Language like that, it's because you are neglecting to add --locked to your cargo command.

The docs at https://writewithharper.com/docs/contributors/review may be neglecting to mention that --locked is needed. I did see it in another thread but didn't remember what the fix was or what thread it was in when I ran into it again.

@hippietrail
Copy link
Contributor Author

hippietrail commented Feb 27, 2025

Well this is puzzling. The cargo command with --locked succeeded but just lint straight afterward still flagged those errors:

% cargo install --git https://github.com/automattic/harper --branch remove-letters harper-cli --locked
...<snip>...
   Compiling harper-cli v0.1.0 (/Users/hippietrail/.cargo/git/checkouts/harper-49fdd5e7f070f674/5e04b56/harper-cli)
    Finished `release` profile [optimized] target(s) in 50.20s
  Installing /Users/hippietrail/.cargo/bin/harper-cli
   Installed package `harper-cli v0.1.0 (https://github.com/automattic/harper?branch=remove-letters#5e04b566)` (executable `harper-cli`)
% just lint /Users/hippietrail/youtube-transcript.md|less -R 
% target/release/harper-cli lint ~/youtube-transcript.md|less -R
% target/debug/harper-cli lint ~/youtube-transcript.md|less -R
Image

Same if I run target/release/harper-cli lint or target/debug/harper-cli lint too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants