mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-24 05:06:41 +00:00
feat: lint on bug-like show/set rules (#1634)
* feat: init linter * feat: init structure * feat: init tests * feat: warn on bad set rules * feat: refactor struct * feat: run check * chore: update message * chore: add hints
This commit is contained in:
parent
ac506dcc31
commit
d6bce89e68
18 changed files with 664 additions and 51 deletions
|
|
@ -477,12 +477,16 @@ impl Redact for RedactFields {
|
|||
}
|
||||
|
||||
pub(crate) fn file_path(uri: &str) -> String {
|
||||
file_path_(&lsp_types::Url::parse(uri).unwrap())
|
||||
}
|
||||
|
||||
pub(crate) fn file_path_(uri: &lsp_types::Url) -> String {
|
||||
let root = if cfg!(windows) {
|
||||
PathBuf::from("C:\\root")
|
||||
} else {
|
||||
PathBuf::from("/root")
|
||||
};
|
||||
let uri = lsp_types::Url::parse(uri).unwrap().to_file_path().unwrap();
|
||||
let uri = uri.to_file_path().unwrap();
|
||||
let abs_path = Path::new(&uri).strip_prefix(root).map(|p| p.to_owned());
|
||||
let rel_path =
|
||||
abs_path.unwrap_or_else(|_| Path::new("-").join(Path::new(&uri).iter().last().unwrap()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue