Skip to content

Commit

Permalink
fix: edge case with base class fields not resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
Desdaemon committed Dec 2, 2023
1 parent 8b51646 commit 9d0429d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ r#"
(argument_list (string) @MAPPED))
(#match? @_mapper "^(mapp|filter|sort)ed$")
(#eq? @_api "api")
(#match? @DEPENDS "^(depend|constrain)s$"))
(#match? @DEPENDS "^(depends|constrains|onchange)$"))
((call
(attribute (_) @MAPPED_TARGET (identifier) @_search)
Expand Down Expand Up @@ -289,13 +289,14 @@ impl Backend {
.nodes_for_capture_index(PyCompletions::PROP)
.next()
.map(|prop| {
dbg!(String::from_utf8_lossy(&contents[prop.byte_range()]));
(
&contents[prop.byte_range()] == b"_inherit",
&contents[prop.byte_range()] == b"_name",
)
})
.unwrap_or((true, false));
if is_inherit && range.contains_end(offset) {
if is_inherit && !is_name && range.contains_end(offset) {
let Some(slice) = rope.get_byte_slice(range.clone()) else {
dbg!(&range);
break 'match_;
Expand Down Expand Up @@ -452,7 +453,10 @@ impl Backend {

let mut single_field = false;
if let Some(depends) = match_.nodes_for_capture_index(PyCompletions::DEPENDS).next() {
single_field = matches!(&contents[depends.byte_range()], b"write" | b"create" | b"constrains");
single_field = matches!(
&contents[depends.byte_range()],
b"write" | b"create" | b"constrains" | b"onchange"
);
}

Some(Mapped {
Expand Down
1 change: 0 additions & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::fmt::Display;

use dashmap::try_result::TryResult;
use lasso::Spur;
use log::warn;
use ropey::Rope;
use tower_lsp::lsp_types::*;
use xmlparser::{StrSpan, Token};
Expand Down

0 comments on commit 9d0429d

Please sign in to comment.