Skip to content

Commit

Permalink
Fix issue with range sorting. Bump to 0.5.41
Browse files Browse the repository at this point in the history
  • Loading branch information
willcrichton committed Nov 7, 2023
1 parent e482cd6 commit 686b6f3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ exclude = ["ide/src/tests/mock_project"]
resolver = "2"

[workspace.dependencies]
rustc_plugin = "=0.7.2-nightly-2023-08-25"
rustc_utils = {version = "=0.7.2-nightly-2023-08-25", features = ["indexical"]}
rustc_plugin = "=0.7.3-nightly-2023-08-25"
rustc_utils = {version = "=0.7.3-nightly-2023-08-25", features = ["indexical"]}
indexical = {version = "0.3.1", default-features = false, features = ["rustc"]}

[profile.bench]
Expand Down
2 changes: 1 addition & 1 deletion crates/flowistry/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "flowistry"
version = "0.5.40"
version = "0.5.41"
edition = "2021"
authors = ["Will Crichton <[email protected]>"]
description = "Modular information flow analysis"
Expand Down
4 changes: 2 additions & 2 deletions crates/flowistry_ide/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "flowistry_ide"
version = "0.5.40"
version = "0.5.41"
edition = "2021"
authors = ["Will Crichton <[email protected]>"]
description = "Information Flow in the IDE for Rust"
Expand All @@ -14,7 +14,7 @@ rustc_private = true
decompose = ["petgraph", "rayon"]

[dependencies]
flowistry = {version = "0.5.40", path = "../flowistry"}
flowistry = {version = "0.5.41", path = "../flowistry"}
anyhow = "1"
log = "0.4"
fluid-let = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/flowistry_ifc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "flowistry_ifc"
version = "0.5.40"
version = "0.5.41"
edition = "2021"
publish = false

[package.metadata.rust-analyzer]
rustc_private = true

[dependencies]
flowistry = {version = "0.5.40", path = "../flowistry"}
flowistry = {version = "0.5.41", path = "../flowistry"}
env_logger = "0.9"
termcolor = "1.1"
anyhow = "1"
Expand Down
2 changes: 1 addition & 1 deletion crates/flowistry_ifc_traits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "flowistry_ifc_traits"
version = "0.5.40"
version = "0.5.41"
edition = "2021"
publish = false

Expand Down
2 changes: 1 addition & 1 deletion ide/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "git"
},
"description": "Information Flow in the IDE for Rust",
"version": "0.5.40",
"version": "0.5.41",
"engines": {
"vscode": "^1.54.0"
},
Expand Down
11 changes: 5 additions & 6 deletions ide/src/focus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ class FocusBodyState {
};

private find_slice_at_selection = (
editor: vscode.TextEditor,
doc: vscode.TextDocument
editor: vscode.TextEditor
): { seeds: Range[]; slice: Range[]; direct_influence: Range[] } => {
let query = this.places.selection_to_interval(
this.mark || editor.selection
Expand All @@ -74,6 +73,8 @@ class FocusBodyState {
sliced = result.overlapping.concat(first_containing);
}

console.log("query:", query, result, sliced);

let seeds = sliced.map(({ value }) => value.ranges).flat();
seeds = _.uniqWith(seeds, _.isEqual);
let slice = sliced.map(({ value }) => value.slice).flat();
Expand All @@ -86,10 +87,8 @@ class FocusBodyState {

render = async (editor: vscode.TextEditor, select = false) => {
let doc = editor.document;
let { seeds, slice, direct_influence } = this.find_slice_at_selection(
editor,
doc
);
let { seeds, slice, direct_influence } =
this.find_slice_at_selection(editor);

if (seeds.length > 0) {
if (select) {
Expand Down
2 changes: 1 addition & 1 deletion ide/src/range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class RangeTree<T> {

["contained", "containing", "overlapping"].forEach((k) => {
let final_ = final as any;
final_[k] = _.sortBy(final_[k], ({ range }) => range.end - range.start);
final_[k] = _.orderBy(final_[k], ({ range }) => [range.end.line - range.start.line, range.end.column - range.start.column]);
});

console.log("Querying", query, "for result", final);
Expand Down

0 comments on commit 686b6f3

Please sign in to comment.