Skip to content

Commit

Permalink
Merge pull request #279 from WillLillis/hash_support
Browse files Browse the repository at this point in the history
Derive `Hash` for `Location` struct
  • Loading branch information
Marwes committed Mar 18, 2024
2 parents 5ff5765 + 718380a commit 2415d52
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ pub type LSPArray = Vec<serde_json::Value>;

/// Position in a text document expressed as zero-based line and character offset.
/// A position is between two characters like an 'insert' cursor in a editor.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Default, Deserialize, Serialize)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Default, Deserialize, Serialize, Hash)]
pub struct Position {
/// Line position in a document (zero-based).
pub line: u32,
Expand All @@ -258,7 +258,7 @@ impl Position {

/// A range in a text document expressed as (zero-based) start and end positions.
/// A range is comparable to a selection in an editor. Therefore the end position is exclusive.
#[derive(Debug, Eq, PartialEq, Copy, Clone, Default, Deserialize, Serialize)]
#[derive(Debug, Eq, PartialEq, Copy, Clone, Default, Deserialize, Serialize, Hash)]
pub struct Range {
/// The range's start position.
pub start: Position,
Expand All @@ -273,7 +273,7 @@ impl Range {
}

/// Represents a location inside a resource, such as a line inside a text file.
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize, Hash)]
pub struct Location {
pub uri: Url,
pub range: Range,
Expand Down

0 comments on commit 2415d52

Please sign in to comment.