Skip to content

Commit

Permalink
Merge 75c4b7a into e41e82b
Browse files Browse the repository at this point in the history
  • Loading branch information
crodas authored Mar 18, 2024
2 parents e41e82b + 75c4b7a commit 0cd0737
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion forc-util/src/fs_locking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ impl PidFileLocking {
if self.is_locked() {
Err(io::Error::new(
std::io::ErrorKind::Other,
"Cannot remove a dirty lock file, it is locked by another process",
format!(
"Cannot remove a dirty lock file, it is locked by another process (PID: {:#?})",
self.get_locker_pid()
),
))
} else {
self.remove_file()?;
Expand Down
2 changes: 1 addition & 1 deletion sway-lsp/src/core/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub fn mark_file_as_dirty(uri: &Url) -> Result<(), LanguageServerError> {
let path = document::get_path_from_url(uri)?;
Ok(PidFileLocking::lsp(path)
.lock()
.map_err(|_| DirectoryError::LspLocksDirFailed)?)
.map_err(|e| DirectoryError::LspLocksDirFailed(e.to_string()))?)
}

/// Removes the corresponding flag file for the specifed Url.
Expand Down
4 changes: 2 additions & 2 deletions sway-lsp/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ pub enum DirectoryError {
ManifestDirNotFound,
#[error("Can't extract project name from {:?}", dir)]
CantExtractProjectName { dir: String },
#[error("Failed to create hidden .lsp_locks directory")]
LspLocksDirFailed,
#[error("Failed to create hidden .lsp_locks directory: {0}")]
LspLocksDirFailed(String),
#[error("Failed to create temp directory")]
TempDirFailed,
#[error("Failed to canonicalize path")]
Expand Down
5 changes: 4 additions & 1 deletion sway-lsp/src/handlers/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ pub async fn handle_did_change_text_document(
state: &ServerState,
params: DidChangeTextDocumentParams,
) -> Result<(), LanguageServerError> {
document::mark_file_as_dirty(&params.text_document.uri)?;
if let Err(err) = document::mark_file_as_dirty(&params.text_document.uri) {
tracing::warn!("Failed to mark file as dirty: {}", err);
}

let (uri, session) = state
.sessions
.uri_and_session_from_workspace(&params.text_document.uri)
Expand Down

0 comments on commit 0cd0737

Please sign in to comment.