diff --git a/assets/licenses.md b/assets/licenses.md new file mode 100644 index 0000000000..b4c705632b --- /dev/null +++ b/assets/licenses.md @@ -0,0 +1 @@ +TWSTS \ No newline at end of file diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 8735f33fbe..e8af0d62fc 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -233,6 +233,7 @@ pub fn init(app_state: Arc, cx: &mut MutableAppContext) { workspace.toggle_sidebar(SidebarSide::Right, cx); }); cx.add_action(Workspace::activate_pane_at_index); + cx.add_action(Workspace::split_pane_with_item); cx.add_action(Workspace::split_pane_with_project_entry); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index b6b00e7869..30f5bef53b 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -62,6 +62,7 @@ actions!( DebugElements, OpenSettings, OpenLog, + OpenLicenses, OpenTelemetryLog, OpenKeymap, OpenDefaultSettings, @@ -184,6 +185,19 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { open_log_file(workspace, app_state.clone(), cx); } }); + cx.add_action({ + let app_state = app_state.clone(); + move |workspace: &mut Workspace, _: &OpenLicenses, cx: &mut ViewContext| { + open_bundled_file( + workspace, + app_state.clone(), + "licenses.md", + "Open Source License Attribution", + "Markdown", + cx, + ); + } + }); cx.add_action({ let app_state = app_state.clone(); move |workspace: &mut Workspace, _: &OpenTelemetryLog, cx: &mut ViewContext| { @@ -199,11 +213,12 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { cx.add_action({ let app_state = app_state.clone(); move |workspace: &mut Workspace, _: &OpenDefaultKeymap, cx: &mut ViewContext| { - open_bundled_config_file( + open_bundled_file( workspace, app_state.clone(), "keymaps/default.json", "Default Key Bindings", + "JSON", cx, ); } @@ -213,11 +228,12 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { move |workspace: &mut Workspace, _: &OpenDefaultSettings, cx: &mut ViewContext| { - open_bundled_config_file( + open_bundled_file( workspace, app_state.clone(), "settings/default.json", "Default Settings", + "JSON", cx, ); } @@ -656,11 +672,12 @@ fn open_telemetry_log_file( }).detach(); } -fn open_bundled_config_file( +fn open_bundled_file( workspace: &mut Workspace, app_state: Arc, asset_path: &'static str, title: &'static str, + language: &'static str, cx: &mut ViewContext, ) { workspace @@ -670,7 +687,7 @@ fn open_bundled_config_file( let text = Assets::get(asset_path).unwrap().data; let text = str::from_utf8(text.as_ref()).unwrap(); project - .create_buffer(text, project.languages().get_language("JSON"), cx) + .create_buffer(text, project.languages().get_language(language), cx) .expect("creating buffers on a local workspace always succeeds") }); let buffer = diff --git a/licenses/test.tx b/licenses/test.tx deleted file mode 100644 index 9f27c62f59..0000000000 --- a/licenses/test.tx +++ /dev/null @@ -1 +0,0 @@ -DATA DATA DATA \ No newline at end of file diff --git a/licenses/test.txt b/licenses/test.txt deleted file mode 100644 index b18c75c886..0000000000 --- a/licenses/test.txt +++ /dev/null @@ -1 +0,0 @@ -Test test \ No newline at end of file diff --git a/script/collect-licenses.js b/script/collect-licenses.js deleted file mode 100755 index a0193a4899..0000000000 --- a/script/collect-licenses.js +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env node - -const fs = require('fs'); - -const file_name = (path) => "./licenses/".concat(path); - -const writeFile = (path, data) => { - fs.writeFile(file_name(path), data, (err) => { - if (err) throw err; - console.log("Saved file") - }); -} - -main(); - -async function main() { - console.log("Here!"); - - writeFile("test.tx", "DATA DATA DATA") - - // Next steps: - // 1a. Add wiring in Zed to check for a licenses markdown file - // 1b. Add wiring in Zed.dev for builds to publish licenses alongside releases as well as licenses for Zed.dev itself - // 2. Figure out how to run those commands and get the license text for each MIT and Apache licensed software - // 3. Add in the configuration file: - // a. and refactor this script to have types of licenses - // b. add callback handlers for each type, - // c. check if the handler succeeds -} \ No newline at end of file diff --git a/script/collect-licenses.rs b/script/collect-licenses.rs new file mode 100755 index 0000000000..2814feaa08 --- /dev/null +++ b/script/collect-licenses.rs @@ -0,0 +1,17 @@ +//usr/bin/env rustc $0 -o a.out && ./a.out ; rm -f ./a.out ; exit + +fn main() { + println!("Hello world"); + + +} + +// Next steps: +// 1a. Add wiring in Zed to check for a licenses markdown file +// 1b. Add wiring in Zed.dev for builds to publish licenses alongside releases as well as licenses for Zed.dev itself +// (e.g. https://github.com/zed-industries/zed.dev/tree/main/content/licenses) +// 2. Figure out how to run those commands and get the license text for each MIT and Apache licensed software +// 3. Add in the configuration file: +// a. and refactor this script to have types of licenses +// b. add callback handlers for each type, +// c. check if the handler succeeds