Skip to content

Commit

Permalink
fix(CI): precommit hooks ruby dependency (bergercookie#159)
Browse files Browse the repository at this point in the history
* fix precommit hooks ruby dependency

* Disable false-positive lints
  • Loading branch information
WillLillis authored Oct 18, 2024
1 parent 7342997 commit 2ec9edb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ jobs:
ruby-version: '3.1'
msys2: true

- name: Install Ruby on Ubuntu
if: runner.os == 'Linux'
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'

- name: Setup Ruby on Ubuntu
if: runner.os == 'Linux'
run: sudo ln -s "$(which ruby)" /usr/bin/ruby3.2

- name: Install pre-commit dependencies
run: python -m pip install pre-commit

Expand Down
6 changes: 6 additions & 0 deletions src/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,9 @@ fn get_project_root(params: &InitializeParams) -> Option<PathBuf> {
if let Some(folders) = &params.workspace_folders {
// if there's multiple, just visit in order until we find a valid folder
for folder in folders {
#[allow(irrefutable_let_patterns)]
if let Ok(parsed) = PathBuf::from_str(folder.uri.path().as_str()) {
#[allow(irrefutable_let_patterns)]
if let Ok(parsed_path) = parsed.canonicalize() {
info!("Detected project root: {}", parsed_path.display());
return Some(parsed_path);
Expand All @@ -1682,8 +1684,11 @@ fn get_project_root(params: &InitializeParams) -> Option<PathBuf> {

// if workspace folders weren't set or came up empty, we check the root_uri
#[allow(deprecated)]
#[allow(irrefutable_let_patterns)]
if let Some(root_uri) = &params.root_uri {
#[allow(irrefutable_let_patterns)]
if let Ok(parsed) = PathBuf::from_str(root_uri.path().as_str()) {
#[allow(irrefutable_let_patterns)]
if let Ok(parsed_path) = parsed.canonicalize() {
info!("Detected project root: {}", parsed_path.display());
return Some(parsed_path);
Expand All @@ -1694,6 +1699,7 @@ fn get_project_root(params: &InitializeParams) -> Option<PathBuf> {
// if both `workspace_folders` and `root_uri` weren't set or came up empty, we check the root_path
#[allow(deprecated)]
if let Some(root_path) = &params.root_path {
#[allow(irrefutable_let_patterns)]
if let Ok(parsed) = PathBuf::from_str(root_path.as_str()) {
if let Ok(parsed_path) = parsed.canonicalize() {
return Some(parsed_path);
Expand Down

0 comments on commit 2ec9edb

Please sign in to comment.