diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs index 78858e7d72cc6186e6098dbf67154b40b799f884..13b3a86822b0d7b61ff1414c7fe58fa87d026a52 100644 --- a/crates/language/src/buffer.rs +++ b/crates/language/src/buffer.rs @@ -806,6 +806,29 @@ impl Buffer { self.sync_parse_timeout = timeout; } + /// Called after an edit to synchronize the buffer's main parse tree with + /// the buffer's new underlying state. + /// + /// Locks the syntax map and interpolates the edits since the last reparse + /// into the foreground syntax tree. + /// + /// Then takes a stable snapshot of the syntax map before unlocking it. + /// The snapshot with the interpolated edits is sent to a background thread, + /// where we ask Tree-sitter to perform an incremental parse. + /// + /// Meanwhile, in the foreground, we block the main thread for up to 1ms + /// waiting on the parse to complete. As soon as it completes, we proceed + /// synchronously, unless a 1ms timeout elapses. + /// + /// If we time out waiting on the parse, we spawn a second task waiting + /// until the parse does complete and return with the interpolated tree still + /// in the foreground. When the background parse completes, call back into + /// the main thread and assign the foreground parse state. + /// + /// If the buffer or grammar changed since the start of the background parse, + /// initiate an additional reparse recursively. To avoid concurrent parses + /// for the same buffer, we only initiate a new parse if we are not already + /// parsing in the background. pub fn reparse(&mut self, cx: &mut ModelContext) { if self.parsing_in_background { return; diff --git a/crates/zed/BundleDocumentTypes.plist b/crates/zed/BundleDocumentTypes.plist new file mode 100644 index 0000000000000000000000000000000000000000..459169afc84cb87ac9e88b101310e2143bcc55c3 --- /dev/null +++ b/crates/zed/BundleDocumentTypes.plist @@ -0,0 +1,62 @@ +CFBundleDocumentTypes + + + CFBundleTypeIconFile + Document + CFBundleTypeRole + Editor + LSHandlerRank + Default + LSItemContentTypes + + public.text + public.plain-text + public.utf8-plain-text + + + + CFBundleTypeIconFile + Document + CFBundleTypeName + Zed Text Document + CFBundleTypeRole + Editor + CFBundleTypeOSTypes + + **** + + LSHandlerRank + Default + CFBundleTypeExtensions + + Gemfile + c + c++ + cc + cpp + css + erb + ex + exs + go + h + h++ + hh + hpp + html + js + json + jsx + md + py + rb + rkt + rs + scm + toml + ts + tsx + txt + + + diff --git a/script/bundle b/script/bundle index 94efbdf0afb75013b690eeb796d58671e44658e9..6fe93ed66cc905d656509bac317b118a8a9cbb37 100755 --- a/script/bundle +++ b/script/bundle @@ -22,7 +22,7 @@ cargo build --release --package cli --target x86_64-apple-darwin echo "Creating application bundle" pushd crates/zed -channel=$(cat RELEASE_CHANNEL) +channel=$(/{while(getline line<\"./crates/zed/BundleDocumentTypes.plist\"){print line}}1" \ + "${app_path}/Contents/WithoutDocumentTypes.plist" \ + > "${app_path}/Contents/Info.plist" +rm "${app_path}/Contents/WithoutDocumentTypes.plist" + if [[ -n $MACOS_CERTIFICATE && -n $MACOS_CERTIFICATE_PASSWORD && -n $APPLE_NOTARIZATION_USERNAME && -n $APPLE_NOTARIZATION_PASSWORD ]]; then echo "Signing bundle with Apple-issued certificate" security create-keychain -p "$MACOS_CERTIFICATE_PASSWORD" zed.keychain || echo ""