Skip to content

Commit

Permalink
feat: go to stage
Browse files Browse the repository at this point in the history
  • Loading branch information
alesbrelih committed Apr 6, 2024
1 parent fa4d300 commit 32132c4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/gitlab_ci_ls_parser/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ impl LSPHandlers {
let document_uri = params.text_document_position_params.text_document.uri;
let document = store.get::<String>(&document_uri.to_string())?;
let position = params.text_document_position_params.position;
let stages = self.stages.lock().unwrap();

let mut locations: Vec<LSPLocation> = vec![];

Expand Down Expand Up @@ -249,6 +250,18 @@ impl LSPHandlers {
}
}
}
parser::PositionType::Stage => {
let line = document.lines().nth(position.line as usize)?;
let word =
parser_utils::ParserUtils::extract_word(line, position.character as usize)?;

if let Some(el) = stages.get(word) {
locations.push(LSPLocation {
uri: el.uri.clone(),
range: el.range.clone(),
});
}
}
parser::PositionType::Variable => {
let line = document.lines().nth(position.line as usize)?;
let word =
Expand Down

0 comments on commit 32132c4

Please sign in to comment.