Skip to content

Commit

Permalink
Update hover.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Jun 21, 2023
1 parent d49e6fa commit 550058e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/els/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ impl<Checker: BuildRunnable, Parser: Parsable> Server<Checker, Parser> {
match self.get_definition(&uri, &token)? {
Some(vi) => {
if let Some(line) = vi.def_loc.loc.ln_begin() {
let line0 = line.saturating_sub(1);
let Some(file_path) = vi.def_loc.module.as_ref() else {
return Ok(None);
};
Expand Down Expand Up @@ -137,7 +138,7 @@ impl<Checker: BuildRunnable, Parser: Parsable> Server<Checker, Parser> {
let uri = NormalizedUrl::try_from(file_path.as_path())?;
code_block += self
.file_cache
.get_line(&uri, line)
.get_line(&uri, line0)
.unwrap_or_default()
.trim_start();
match code_block.chars().last() {
Expand Down

0 comments on commit 550058e

Please sign in to comment.