Draft a project part of the prettier
This commit is contained in:
parent
eced842dfc
commit
553abd01be
6 changed files with 122 additions and 14 deletions
|
@ -3,7 +3,18 @@ name = "prettier"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[lib]
|
||||
path = "src/prettier.rs"
|
||||
|
||||
[dependencies]
|
||||
language = { path = "../language" }
|
||||
gpui = { path = "../gpui" }
|
||||
fs = { path = "../fs" }
|
||||
|
||||
anyhow.workspace = true
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
language = { path = "../language", features = ["test-support"] }
|
||||
gpui = { path = "../gpui", features = ["test-support"] }
|
||||
fs = { path = "../fs", features = ["test-support"] }
|
||||
|
|
|
@ -1,14 +1,46 @@
|
|||
pub fn add(left: usize, right: usize) -> usize {
|
||||
left + right
|
||||
pub use std::path::{Path, PathBuf};
|
||||
pub use std::sync::Arc;
|
||||
|
||||
use fs::Fs;
|
||||
use gpui::ModelHandle;
|
||||
use language::{Buffer, Diff};
|
||||
|
||||
pub struct Prettier {
|
||||
_private: (),
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
type NodeRuntime = ();
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
impl Prettier {
|
||||
// This was taken from the prettier-vscode extension.
|
||||
pub const CONFIG_FILE_NAMES: &'static [&'static str] = &[
|
||||
".prettierrc",
|
||||
".prettierrc.json",
|
||||
".prettierrc.json5",
|
||||
".prettierrc.yaml",
|
||||
".prettierrc.yml",
|
||||
".prettierrc.toml",
|
||||
".prettierrc.js",
|
||||
".prettierrc.cjs",
|
||||
"package.json",
|
||||
"prettier.config.js",
|
||||
"prettier.config.cjs",
|
||||
".editorconfig",
|
||||
];
|
||||
|
||||
pub async fn locate(starting_path: Option<&Path>, fs: Arc<dyn Fs>) -> PathBuf {
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub async fn start(prettier_path: &Path, node: Arc<NodeRuntime>) -> anyhow::Result<Self> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub async fn format(&self, buffer: &ModelHandle<Buffer>) -> anyhow::Result<Diff> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub async fn clear_cache(&self) -> anyhow::Result<()> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue