Adds a threadsafe Uri::file() function, which allows creating a new Uri for each repository in the workspace (when supported).
MGJ23FHFUNT4RSJP3AW5ZALGEDTNZPR4PLHLPOCFNEBIX2WHV2JAC threadsafe_function! {uri ("Uri": napi::bindgen_prelude::Function<napi::Unknown, napi::Unknown>) {"file":file(String) -> crate::vscode_sys::reference::UriRef;}}
pub fn get(env: &napi::Env) -> Result<Prototype, napi::Error> {let vscode_object = crate::vscode_sys::VscodeContext::vscode(env)?;let namespace: napi::bindgen_prelude::Object = vscode_object.get_named_property($js_namespace_name)?;
pub fn get(vscode_object: &napi::bindgen_prelude::Object) -> Result<Prototype, napi::Error> {let parent: $js_parent_type = vscode_object.get_named_property($js_parent_name)?;
Event::OpenWorkspaceFolder { uri } => {// TODO: handle multiple repositories per workspace// TODO: properly handle URIs
Event::OpenWorkspaceFolder { uri: raw_uri } => {let uri = match UriAbsoluteStr::new(raw_uri) {Ok(valid_uri) => valid_uri,Err(error) => {tracing::error!(message = "Invalid URI", ?raw_uri, ?error);continue;}};// TODO: handle different schemes using `vscode.workspace.fs`if uri.scheme_str() != "file" {tracing::info!(message = "Skipping unhandled URI scheme", ?uri);continue;}let workspace_path = Utf8PathBuf::from(uri.path_str());// TODO: multiple repositories per workspacelet repository_path = workspace_path.clone();let repository_uri_ref = match threadsafe_functions.uri_file(repository_path.to_string()).await{Ok(repository_uri_ref) => repository_uri_ref,Err(error) => {tracing::error!(message = "Failed to parse URI",?repository_path,?error);continue;}};
pub fn start(env: &napi::Env) -> Result<(), napi::Error> {let threadsafe_functions = threadsafe_function::ThreadsafeFunctions::get(env)?;
pub fn start(vscode_object: &napi::bindgen_prelude::Object) -> Result<(), napi::Error> {let threadsafe_functions = threadsafe_function::ThreadsafeFunctions::get(vscode_object)?;