Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add action to open licenses file
Mikayla Maki9d5803206456
diff --git a/assets/licenses.md b/assets/licenses.mdnew file mode 100644index 00000000000..b4c705632be--- /dev/null+++ b/assets/licenses.md@@ -0,0 +1 @@+TWSTS\ No newline at end of filediff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex 8735f33fbe6..e8af0d62fca 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -233,6 +233,7 @@ pub fn init(app_state: Arc<AppState>, 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.rsindex b6b00e78699..30f5bef53ba 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<AppState>, 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<Workspace>| {+ 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<Workspace>| {@@ -199,11 +213,12 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {cx.add_action({let app_state = app_state.clone();move |workspace: &mut Workspace, _: &OpenDefaultKeymap, cx: &mut ViewContext<Workspace>| {- 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<AppState>, cx: &mut gpui::MutableAppContext) {move |workspace: &mut Workspace,_: &OpenDefaultSettings,cx: &mut ViewContext<Workspace>| {- 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<AppState>,asset_path: &'static str,title: &'static str,+ language: &'static str,cx: &mut ViewContext<Workspace>,) {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.txdeleted file mode 100644index 9f27c62f597..00000000000--- a/licenses/test.tx+++ /dev/null@@ -1 +0,0 @@-DATA DATA DATA\ No newline at end of filediff --git a/licenses/test.txt b/licenses/test.txtdeleted file mode 100644index b18c75c886c..00000000000--- a/licenses/test.txt+++ /dev/null@@ -1 +0,0 @@-Test test\ No newline at end of filediff --git a/script/collect-licenses.js b/script/collect-licenses.jsdeleted file mode 100755index a0193a4899f..00000000000--- 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 filediff --git a/script/collect-licenses.rs b/script/collect-licenses.rsnew file mode 100755index 00000000000..2814feaa089--- /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