assets/licenses.md 🔗
@@ -0,0 +1 @@
+TWSTS
Mikayla Maki created
assets/licenses.md | 1 +
crates/workspace/src/workspace.rs | 1 +
crates/zed/src/zed.rs | 25 +++++++++++++++++++++----
licenses/test.tx | 1 -
licenses/test.txt | 1 -
script/collect-licenses.js | 29 -----------------------------
script/collect-licenses.rs | 17 +++++++++++++++++
7 files changed, 40 insertions(+), 35 deletions(-)
@@ -0,0 +1 @@
+TWSTS
@@ -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);
@@ -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 =
@@ -1 +0,0 @@
-DATA DATA DATA
@@ -1 +0,0 @@
-Test test
@@ -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
-}
@@ -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