Skip to content

Commit 4f85ac1

Browse files
authored
Merge pull request #3120 from github/nora/make-top-banner-sticky
Make model editor top banner sticky
2 parents f596f7e + 118ad9d commit 4f85ac1

File tree

2 files changed

+28
-21
lines changed

2 files changed

+28
-21
lines changed

extensions/ql-vscode/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Preserve focus on results viewer when showing a location in a file. [#3088](https://github.com/github/vscode-codeql/pull/3088)
88
- The `dataflowtracking` and `tainttracking` snippets expand to the new module-based interface. [#3091](https://github.com/github/vscode-codeql/pull/3091)
99
- The compare view will now show a loading message while the results are loading. [#3107](https://github.com/github/vscode-codeql/pull/3107)
10+
- Make top-banner of the model editor sticky [#3120](https://github.com/github/vscode-codeql/pull/3120)
1011

1112
## 1.10.0 - 16 November 2023
1213

extensions/ql-vscode/src/view/model-editor/ModelEditor.tsx

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@ const LoadingContainer = styled.div`
2727
font-weight: 600;
2828
`;
2929

30-
const ModelEditorContainer = styled.div`
31-
margin-top: 1rem;
32-
`;
30+
const ModelEditorContainer = styled.div``;
3331

3432
const HeaderContainer = styled.div`
3533
display: flex;
3634
flex-direction: row;
3735
align-items: end;
36+
background-color: var(--vscode-editor-background);
37+
position: sticky;
38+
z-index: 1;
39+
top: 0;
40+
padding-top: 1rem;
41+
padding-bottom: 1rem;
3842
`;
3943

4044
const HeaderColumn = styled.div`
@@ -67,7 +71,7 @@ const EditorContainer = styled.div`
6771
const ButtonsContainer = styled.div`
6872
display: flex;
6973
gap: 0.4em;
70-
margin-bottom: 1rem;
74+
margin-top: 1rem;
7175
`;
7276

7377
type Props = {
@@ -300,6 +304,25 @@ export function ModelEditor({
300304
</LinkIconButton>
301305
)}
302306
</HeaderRow>
307+
<HeaderRow>
308+
<ButtonsContainer>
309+
<VSCodeButton
310+
onClick={onSaveAllClick}
311+
disabled={modifiedSignatures.size === 0}
312+
>
313+
Save all
314+
</VSCodeButton>
315+
<VSCodeButton appearance="secondary" onClick={onRefreshClick}>
316+
Refresh
317+
</VSCodeButton>
318+
{viewState.showGenerateButton &&
319+
viewState.mode === Mode.Framework && (
320+
<VSCodeButton onClick={onGenerateFromSourceClick}>
321+
Generate
322+
</VSCodeButton>
323+
)}
324+
</ButtonsContainer>
325+
</HeaderRow>
303326
</HeaderColumn>
304327
<HeaderSpacer />
305328
<HeaderColumn>
@@ -313,23 +336,6 @@ export function ModelEditor({
313336
</HeaderContainer>
314337

315338
<EditorContainer>
316-
<ButtonsContainer>
317-
<VSCodeButton
318-
onClick={onSaveAllClick}
319-
disabled={modifiedSignatures.size === 0}
320-
>
321-
Save all
322-
</VSCodeButton>
323-
<VSCodeButton appearance="secondary" onClick={onRefreshClick}>
324-
Refresh
325-
</VSCodeButton>
326-
{viewState.showGenerateButton &&
327-
viewState.mode === Mode.Framework && (
328-
<VSCodeButton onClick={onGenerateFromSourceClick}>
329-
Generate
330-
</VSCodeButton>
331-
)}
332-
</ButtonsContainer>
333339
<ModeledMethodsList
334340
methods={methods}
335341
modeledMethodsMap={modeledMethods}

0 commit comments

Comments
 (0)