mirror of
https://github.com/oxalica/nil.git
synced 2025-10-06 00:32:51 +02:00
Don't complete inside comments (#171)
This commit is contained in:
@@ -158,9 +158,11 @@ pub(crate) fn completions(
|
||||
|
||||
impl Context<'_> {
|
||||
fn complete(&mut self) -> Option<()> {
|
||||
// Do not complete inside strings.
|
||||
// Do not complete inside strings or comments.
|
||||
// TODO: Escapes and `${}` snippets?
|
||||
if let T!["''"] | T!['"'] | SyntaxKind::STRING_FRAGMENT = self.token.kind() {
|
||||
if let T!["''"] | T!['"'] | SyntaxKind::STRING_FRAGMENT | SyntaxKind::COMMENT =
|
||||
self.token.kind()
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -1054,4 +1056,12 @@ stdenv.mkDerivation {
|
||||
expect!["(Param) { foo, bar ? foo }: 42"],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_inside_comment() {
|
||||
check_no("# l$0", "let");
|
||||
check_no("/* l$0 */", "let");
|
||||
check_no("let abc = 1; in # ab$0", "abc");
|
||||
check_no("let abc = 1; in /* ab$0 */", "abc");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user