Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pjlast/sourcegraph cody support #1

Draft
wants to merge 122 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
122 commits
Select commit Hold shift click to select a range
4bec842
Copy copilot crate and rename everything to Cody
pjlast Mar 21, 2024
710d69a
Add LICENSE-GPL symbolic link
pjlast Mar 21, 2024
7f76866
Read Cody agent binary and get to compilation with Cody
pjlast Mar 22, 2024
dd2e189
Add Vue language server auto update (#9474)
weartist Mar 19, 2024
0df6c2a
chore: Merge zed lib with zed binary.
osiewicz Mar 19, 2024
366b445
Clean up the live_kit_client manifest file (#9532)
TDecking Mar 19, 2024
3ec89eb
Improve Ruby language to recognize Guardfiles (#9530)
Otterpocket Mar 19, 2024
5154078
Introduce `extension-cli` binary, for packaging extensions in CI (#9523)
maxbrunsfeld Mar 19, 2024
57893b3
Windows: Auto close HANDLE (#9429)
kazatsuyu Mar 19, 2024
4f347d7
Simplify and document parts of linux text system code (#9443)
niklaswimmer Mar 19, 2024
7a35765
suggested extensions (#9526)
ConradIrwin Mar 19, 2024
af3414b
Update binary name for extension CLI (#9541)
maxdeviant Mar 19, 2024
bbc98ad
Image viewer (#9425)
rgbkrk Mar 19, 2024
3ac2ea2
Add an animation to the LSP checking indicator (#9463)
mikayla-maki Mar 19, 2024
0380e4e
windows: fix 'space' keystroke keydown event (#9476)
zaucy Mar 19, 2024
d96fb23
Insert hitbox if div contains tooltip (#9545)
as-cii Mar 19, 2024
3934ee8
Add GitHub Action for publishing the extension CLI (#9542)
maxdeviant Mar 19, 2024
9668b0d
Allow AI interactions to be proxied through Zed's server so you don't…
nathansobo Mar 19, 2024
8e8733f
wayland: fix handling of non-discrete scroll events (#9548)
apricotbucket28 Mar 19, 2024
358e3b7
windows: Properly handle `DPI` (#9456)
JunkuiZhang Mar 19, 2024
075687a
wayland: change some borrow_mut to borrow, reduce borrow scopes, fix …
flukejones Mar 19, 2024
5f03577
windows: Implement `app_version` (#9410)
JunkuiZhang Mar 19, 2024
f0ab338
Perform extension packaging in extension-cli (#9549)
maxbrunsfeld Mar 19, 2024
3ebf5a2
Fix incorrect git ref check in publish extension cli workflow
maxbrunsfeld Mar 19, 2024
46c808d
Fix merge conflict in collab (#9550)
ConradIrwin Mar 19, 2024
06be943
Channel chat: Add edit message (#9035)
RemcoSmitsDev Mar 20, 2024
60f24dd
windows: Fix title bar height when maximized (#9449)
zaucy Mar 20, 2024
fc8fbe0
Allow to handle autoclosed characters differently (#8666)
timfjord Mar 20, 2024
0a7fc9c
Fix licensing
as-cii Mar 20, 2024
5639ffe
Fix licensing errors
as-cii Mar 20, 2024
2447458
ui: Make `top_padding` an associated function on the `TitleBar` (#9577)
maxdeviant Mar 20, 2024
3fcf5e6
Add support for applying theme after extension is installed (#9529)
huacnlee Mar 20, 2024
ac1e66b
VS Code -> Zed tasks converter (#9538)
Anthony-Eid Mar 20, 2024
dff5c69
v0.129.x dev
mikayla-maki Mar 20, 2024
ffa4b8a
Fix binary name for extension CLI (#9591)
maxdeviant Mar 20, 2024
da315ac
Format `prettier_server.js` (#9583)
mrnugget Mar 20, 2024
c9db1b7
Only allow opening one Extensions view (#9569)
huacnlee Mar 20, 2024
3a554a0
Allow extensions to define more of the methods in the LspAdapter trai…
maxbrunsfeld Mar 20, 2024
8a385a0
Fix skip prompt warning (#9590)
mikayla-maki Mar 20, 2024
9bd67ed
Windows: Refactoring (#9580)
kazatsuyu Mar 20, 2024
b9797c3
Add a schema to extensions, to prevent installing extensions on too o…
maxbrunsfeld Mar 20, 2024
4bdcd9b
Fix bugs in linux text system (#9604)
mikayla-maki Mar 20, 2024
bc283bd
Action release handlers (#8782)
alygin Mar 21, 2024
5e6248a
Allow specifying no base keymap (#9471)
zaucy Mar 21, 2024
7103878
Wayland: double click (#9608)
mikayla-maki Mar 21, 2024
df0c0f4
Fix copilot modal (#9613)
ConradIrwin Mar 21, 2024
9005866
Make it (a tiny bit) easier to run your own collab (#9557)
ConradIrwin Mar 21, 2024
9253054
get-preview-channel-changes errors on invalid token (#9616)
ConradIrwin Mar 21, 2024
67430f5
Fix `prettier-plugin-organize-imports` plugin removes used imports (#…
RemcoSmitsDev Mar 21, 2024
01b2f1a
chore: Bump Rust version to 1.77 (#9631)
osiewicz Mar 21, 2024
38e5db2
lsp: Add partial support for insert/replace completions (#9634)
osiewicz Mar 21, 2024
6e39cf7
extension_cli: Don't propagate errors caused by trying to read `Cargo…
maxdeviant Mar 21, 2024
6f02028
Normalize `-` to `_` in resulting Wasm file names (#9644)
maxdeviant Mar 21, 2024
115f1ad
language: Remove buffer fingerprinting (#9007)
osiewicz Mar 21, 2024
06e23b3
Add a script for bumping the extension CLI (#9646)
maxdeviant Mar 21, 2024
a7a6469
Windows: Not logging frequent WM_PAINTs (#9566)
kazatsuyu Mar 21, 2024
6cb6a40
windows: Avoid recording minimized position to database (#9407)
kazatsuyu Mar 21, 2024
6220bcf
windows: display icon (#9571)
JunkuiZhang Mar 21, 2024
e3e4905
Windows: Fix XButton direction (#9629)
kazatsuyu Mar 21, 2024
547b5a5
Fix `IME` window position with scale factor greater than 1.0 (#9637)
JunkuiZhang Mar 21, 2024
3e4e709
extension_cli: Populate grammars from `grammars` directory for legacy…
maxdeviant Mar 21, 2024
0874e1e
Implement is_minimized for macOS (#9651)
mikayla-maki Mar 21, 2024
98c8bfd
collab: Bump minimal client version to 0.127.3 (#9649)
osiewicz Mar 21, 2024
aada4b7
Do not enable venv in terminal for bash-like oneshot task invocations…
WeetHet Mar 21, 2024
8c4ee36
Check for user installed clangd (#9605)
zaucy Mar 21, 2024
c05d7d3
Revert "chore: Bump Rust version to 1.77 (#9631)" (#9658)
maxdeviant Mar 21, 2024
4d4b1ae
windows: implement `IME` caret movement and editing while composing (…
JunkuiZhang Mar 21, 2024
a1628f6
Remove incorrect venv base directory used (#9661)
WeetHet Mar 21, 2024
e5cc37a
Fix invalid highlight position for `(edited)` text (#9660)
RemcoSmitsDev Mar 21, 2024
91bb970
Revert "language: Remove buffer fingerprinting (#9007)"
ConradIrwin Mar 21, 2024
77b469f
Fix error handling in buffer open (#9667)
ConradIrwin Mar 21, 2024
33aa8f7
windows: fix window activate action (#9664)
JunkuiZhang Mar 21, 2024
14f5d51
windows: User installed language server support (#9606)
zaucy Mar 21, 2024
d80931b
linux: fix word move/select shortcuts (#9673)
apricotbucket28 Mar 21, 2024
836aed6
Fix typo (mimized -> minimized) (#9674)
danielzsh Mar 21, 2024
3a6d9c7
Hard code max token counts for supported models (#9675)
nathansobo Mar 22, 2024
3f2e74c
Fix `compute_width_for_char` (#9643)
JunkuiZhang Mar 22, 2024
bfc1d49
Revert "Revert "chore: Bump Rust version to 1.77 (#9631)"" (#9672)
osiewicz Mar 22, 2024
1e98f62
chat panel: Fix tooltips not working for links (#9691)
bennetbo Mar 22, 2024
39ea21d
Assign OPENAI_API_KEY from a k8s secret in the collab deployment (#9703)
nathansobo Mar 22, 2024
8bee8bf
remoting (#9680)
ConradIrwin Mar 22, 2024
afda3be
Extensions registering tasks (#9572)
osiewicz Mar 22, 2024
9f13db3
Add setting to allow disabling the Assistant (#9706)
maxdeviant Mar 22, 2024
f9886c1
Update to vscode-eslint 2.4.4 & support flat config file extensions (…
mrnugget Mar 22, 2024
7ba54f7
Improve the clarity of multi buffer headers (#9722)
mikayla-maki Mar 22, 2024
957060b
Fix issues with extension API that come up when moving Svelte into an…
maxbrunsfeld Mar 23, 2024
f65d363
Add license symlinks for svelta and uiua extensions
maxbrunsfeld Mar 23, 2024
f959b0b
Use upstream cargo-about
maxbrunsfeld Mar 23, 2024
8de5f50
markdown preview: Insert missing line break on hard break (#9687)
bennetbo Mar 25, 2024
0ad06a5
Workspace configuration for elixir-ls LSP (#9330)
moomerman Mar 25, 2024
ccd2618
markdown preview: Improve task list visuals (#9695)
bennetbo Mar 25, 2024
36209eb
change HashSet to BTreeSet (#9734)
weartist Mar 25, 2024
f3efd69
Support newline and tab literals in regex search-and-replace operatio…
mayfieldiv Mar 25, 2024
e19faa0
gpui: update ashpd and open dependency
niklaswimmer Mar 13, 2024
56fcf3e
gpui: make build dependencies mac only
niklaswimmer Mar 13, 2024
817eb63
gpui: Update cosmic-text and resvg dependency
niklaswimmer Mar 19, 2024
491c3e6
gpui: Update image dependency
niklaswimmer Mar 23, 2024
8e55301
windows: update text system to new cosmic version
niklaswimmer Mar 24, 2024
285d697
Fix Prisma indentation size (#9753)
Ko1103 Mar 25, 2024
f002f84
chore: Revert "gpui: update dependencies" (#9774)
osiewicz Mar 25, 2024
4d6d3e8
Change maximum height of TitleBar (#9758)
Aaron-212 Mar 25, 2024
0bfb7ca
Document main workspace structs (#9772)
SomeoneToIgnore Mar 25, 2024
b81bc27
Use `.is_some_and()` instead of `.is_some() && .unwrap()` (#9704)
WaffleLapkin Mar 25, 2024
06ebf9b
extension_cli: Clear out existing manifest collections for old `exten…
maxdeviant Mar 25, 2024
fa28029
Bump Tree-sitter for inclusion of strncat in wasm c stdlib
maxbrunsfeld Mar 25, 2024
548ccae
Windows: Better cursor (#9451)
kazatsuyu Mar 25, 2024
c953756
Handle first click on Zed window (#9553)
danielzsh Mar 25, 2024
9f64ab1
Fix dependency install script on RHEL derivatives (#9684)
jakobkg Mar 25, 2024
cdc4b53
linux: Implement `restart` and `app_path` (#9681)
bajrangCoder Mar 25, 2024
c163ec6
windows: Mouse wheel coordinates fix (#9749)
zaucy Mar 25, 2024
c9efd90
Windows: fix initial active status (#9694)
kazatsuyu Mar 25, 2024
64062d8
Fix key repeat after releasing a different key on Wayland (#9768)
RoblKyogre Mar 25, 2024
df7f694
X11: Double click (#9739)
hackedd Mar 25, 2024
621d8d8
More C path suffixes (#9761)
zaucy Mar 25, 2024
03b8da2
Restore the hitbox of the excerpt header (#9790)
mikayla-maki Mar 25, 2024
cd76974
Fix next/prev shortcuts handling in the File Finder (#9785)
alygin Mar 25, 2024
68c666d
windows: Add extension builder support (#9791)
zaucy Mar 25, 2024
41699b8
Add telemetry events for loading extensions (#9793)
maxbrunsfeld Mar 25, 2024
33f08ce
Remove old extension dir when upgrading (#9800)
maxbrunsfeld Mar 26, 2024
376156b
Consolidate more extension API structs that were duplicated btwn clie…
maxbrunsfeld Mar 26, 2024
3d9d4e1
Add ability to specify binary path/args for `gopls` (#9803)
mrnugget Mar 26, 2024
0aacf9b
Merge main
pjlast Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
windows: Fix title bar height when maximized (zed-industries#9449)
screenshots and description incoming

## title bar when window is maximized
| before | after |
| ---    | ---   |
|
![image](https://github.com/zed-industries/zed/assets/1284289/075a943d-54db-4b71-9fa0-15f823255182)
|
![image](https://github.com/zed-industries/zed/assets/1284289/39a1d381-fcfd-4651-aab4-231a8ec3bd99)
|

## ~~caption buttons at 200%~~
~~buttons are now properly responsive at different scales~~
~~closes zed-industries#9438~~
~~proper scale factor handling in follow up PR (possibly zed-industries#9440)~~

<details>
  <summary>out of date image</summary>


![scale-factor](https://github.com/zed-industries/zed/assets/1284289/299d37b8-0d2e-4f2e-81db-2fff6fc59a62)
</details>

should be fixed by zed-industries#9456


Release Notes:

- N/A
  • Loading branch information
zaucy authored and pjlast committed Mar 26, 2024
commit 60f24dd6fd534a7ffe0552e6a8735ab7525e0677
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 27 additions & 22 deletions crates/gpui/src/platform/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,33 134,37 @@ impl WindowsWindowInner {
return false;
}

fn get_titlebar_rect(&self) -> anyhow::Result<RECT> {
let top_and_bottom_borders = 2;
let scale_factor = self.scale_factor.get();
let theme = unsafe { OpenThemeData(self.hwnd, w!("WINDOW")) };
let title_bar_size = unsafe {
GetThemePartSize(
theme,
HDC::default(),
WP_CAPTION.0,
CS_ACTIVE.0,
None,
TS_TRUE,
)
}?;
unsafe { CloseThemeData(theme) }?;

let mut height =
(title_bar_size.cy as f32 * scale_factor).round() as i32 top_and_bottom_borders;
pub(crate) fn title_bar_padding(&self) -> Pixels {
// using USER_DEFAULT_SCREEN_DPI because GPUI handles the scale with the scale factor
let padding = unsafe { GetSystemMetricsForDpi(SM_CXPADDEDBORDER, USER_DEFAULT_SCREEN_DPI) };
px(padding as f32)
}

pub(crate) fn title_bar_top_offset(&self) -> Pixels {
if self.is_maximized() {
let dpi = unsafe { GetDpiForWindow(self.hwnd) };
height = unsafe { (GetSystemMetricsForDpi(SM_CXPADDEDBORDER, dpi) * 2) as i32 };
self.title_bar_padding() * 2
} else {
px(0.)
}
}

pub(crate) fn title_bar_height(&self) -> Pixels {
// todo(windows) this is hard set to match the ui title bar
// in the future the ui title bar component will report the size
px(32.) self.title_bar_top_offset()
}

pub(crate) fn caption_button_width(&self) -> Pixels {
// todo(windows) this is hard set to match the ui title bar
// in the future the ui title bar component will report the size
px(36.)
}

fn get_titlebar_rect(&self) -> anyhow::Result<RECT> {
let height = self.title_bar_height();
let mut rect = RECT::default();
unsafe { GetClientRect(self.hwnd, &mut rect) }?;
rect.bottom = rect.top height;
rect.bottom = rect.top ((height.0 as f32 * self.scale_factor.get()).round() as i32);
Ok(rect)
}

Expand Down Expand Up @@ -923,7 927,8 @@ impl WindowsWindowInner {
let titlebar_rect = self.get_titlebar_rect();
if let Ok(titlebar_rect) = titlebar_rect {
if cursor_point.y < titlebar_rect.bottom {
let caption_btn_width = unsafe { GetSystemMetricsForDpi(SM_CXSIZE, dpi) };
let caption_btn_width =
(self.caption_button_width().0 * self.scale_factor.get()) as i32;
if cursor_point.x >= titlebar_rect.right - caption_btn_width {
return LRESULT(HTCLOSE as _);
} else if cursor_point.x >= titlebar_rect.right - caption_btn_width * 2 {
Expand Down
3 changes: 3 additions & 0 deletions crates/ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 23,9 @@ story = { workspace = true, optional = true }
strum = { version = "0.25.0", features = ["derive"] }
theme.workspace = true

[target.'cfg(windows)'.dependencies]
windows.workspace = true

[features]
default = []
stories = ["dep:itertools", "dep:story"]
48 changes: 31 additions & 17 deletions crates/ui/src/components/title_bar/title_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 10,40 @@ pub struct TitleBar {
content: Stateful<Div>,
children: SmallVec<[AnyElement; 2]>,
}
#[cfg(not(target_os = "windows"))]
fn title_bar_top_padding(_cx: &WindowContext) -> Pixels {
px(0.)
}

#[cfg(target_os = "windows")]
fn title_bar_top_padding(cx: &WindowContext) -> Pixels {
use windows::Win32::UI::{
HiDpi::GetSystemMetricsForDpi,
WindowsAndMessaging::{SM_CXPADDEDBORDER, USER_DEFAULT_SCREEN_DPI},
};

// this top padding is not dependent on the title bar style and is instead a quirk of maximized windows on Windows
// https://devblogs.microsoft.com/oldnewthing/20150304-00/?p=44543
let padding = unsafe { GetSystemMetricsForDpi(SM_CXPADDEDBORDER, USER_DEFAULT_SCREEN_DPI) };
if cx.is_maximized() {
px((padding * 2) as f32)
} else {
px(0.)
}
}

impl TitleBar {
#[cfg(not(target_os = "windows"))]
pub fn height(cx: &mut WindowContext) -> Pixels {
(1.75 * cx.rem_size()).max(px(32.))
}

#[cfg(target_os = "windows")]
pub fn height(_cx: &mut WindowContext) -> Pixels {
// todo(windows) instead of hard coded size report the actual size to the Windows platform API
px(32.)
}

pub fn new(id: impl Into<ElementId>) -> Self {
Self {
platform_style: PlatformStyle::platform(),
Expand All @@ -29,16 57,6 @@ impl TitleBar {
self.platform_style = style;
self
}

fn top_padding(&self, cx: &WindowContext) -> Pixels {
if self.platform_style == PlatformStyle::Windows && cx.is_maximized() {
// todo(windows): get padding from win32 api, need HWND from window context somehow
// should be GetSystemMetricsForDpi(SM_CXPADDEDBORDER, dpi) * 2
px(8.)
} else {
px(0.)
}
}
}

impl InteractiveElement for TitleBar {
Expand All @@ -58,13 76,11 @@ impl ParentElement for TitleBar {
impl RenderOnce for TitleBar {
fn render(self, cx: &mut WindowContext) -> impl IntoElement {
let height = Self::height(cx);
let top_padding = self.top_padding(cx);

h_flex()
.id("titlebar")
.w_full()
.pt(top_padding)
.h(height)
.pt(title_bar_top_padding(cx))
.h(height title_bar_top_padding(cx))
.map(|this| {
if cx.is_fullscreen() {
this.pl_2()
Expand All @@ -88,9 104,7 @@ impl RenderOnce for TitleBar {
.children(self.children),
)
.when(self.platform_style == PlatformStyle::Windows, |title_bar| {
let button_height = Self::height(cx) - top_padding;

title_bar.child(WindowsWindowControls::new(button_height))
title_bar.child(WindowsWindowControls::new(height))
})
}
}
8 changes: 5 additions & 3 deletions crates/ui/src/components/title_bar/windows_window_controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 98,11 @@ impl WindowsCaptionButton {

impl RenderOnce for WindowsCaptionButton {
fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
// todo(windows): get padding from win32 api, need HWND from window context somehow
// should be GetSystemMetricsForDpi(SM_CXSIZE, dpi)
let width = px(36.0);
// todo(windows) report this width to the Windows platform API
// NOTE: this is intentionally hard coded. An option to use the 'native' size
// could be added when the width is reported to the Windows platform API
// as this could change between future Windows versions.
let width = px(36.);

h_flex()
.id(self.id)
Expand Down