Skip to content

Fixes backslash unicode autocompletion #2504

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

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3587,7 +3587,7 @@ pub fn completion(cx: &mut Context) {
use helix_core::chars;
let mut iter = text.chars_at(cursor);
iter.reverse();
let offset = iter.take_while(|ch| chars::char_is_word(*ch)).count();
let offset = iter.take_while(|ch| chars::char_is_whitespace(*ch)).count();
Copy link
Member

@archseer archseer May 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be the reverse of what you want: you want to scan backwards while char is not whitespace (stop on first whitespace)

Copy link
Contributor Author

@VarLad VarLad May 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@archseer doing !chars::char_is_whitespace seems to break everything
Another solution proposed @ChrHorn chars::char_is_word(*ch) || *ch == '\\' which solves this particular problem.
I guess we can go along with that for now?
It would be nice if we could define this logic for the Julia LSP specifically so as to not break other langauges

let start_offset = cursor.saturating_sub(offset);
let prefix = text.slice(start_offset..cursor).to_string();

Expand Down