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

feat: add a setting to disable the loading spinner animation #561

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions lean4-infoview-api/src/infoviewApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export interface InfoviewConfig {
emphasizeFirstGoal: boolean
reverseTacticState: boolean
showTooltipOnHover: boolean
disableLoadingSpinner: boolean
}

export const defaultInfoviewConfig: InfoviewConfig = {
Expand All @@ -97,6 +98,7 @@ export const defaultInfoviewConfig: InfoviewConfig = {
emphasizeFirstGoal: false,
reverseTacticState: false,
showTooltipOnHover: true,
disableLoadingSpinner: false,
}

export type InfoviewActionKind =
Expand Down
24 changes: 14 additions & 10 deletions lean4-infoview/src/infoview/info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ interface InfoStatusBarProps extends InfoPinnable, PausableProps {
}

const InfoStatusBar = React.memo((props: InfoStatusBarProps) => {
const config = React.useContext(ConfigContext)
const { kind, onPin, status, pos, isPaused, setPaused, triggerUpdate } = props

const ec = React.useContext(EditorContext)
Expand Down Expand Up @@ -80,16 +81,19 @@ const InfoStatusBar = React.memo((props: InfoStatusBarProps) => {
{isPinned && !isPaused && ' (pinned)'}
{!isPinned && isPaused && ' (paused)'}
{isPinned && isPaused && ' (pinned and paused)'}
<span style={spinnerStyle} className="mh2 codicon codicon-loading" title="updating">
<style>
{`
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
`}
</style>
</span>
{!config.disableLoadingSpinner && (
<span style={spinnerStyle} className="mh2 codicon codicon-loading" title="updating">
<style>
{`
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
`}
</style>
</span>
)}

<span
className="fr"
onClick={e => {
Expand Down
5 changes: 5 additions & 0 deletions vscode-lean4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@
"default": true,
"markdownDescription": "Show the tooltip for an interactive element (e.g. a subexpression) when the pointer hovers over that element. When disabled, the element must be clicked for the tooltip to show up."
},
"lean4.infoview.disableLoadingSpinner": {
"type": "boolean",
"default": false,
"markdownDescription": "Disable the loading spinner on the infoview."
},
"lean4.elaborationDelay": {
"type": "number",
"default": 200,
Expand Down
4 changes: 4 additions & 0 deletions vscode-lean4/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export function getInfoViewShowTooltipOnHover(): boolean {
return workspace.getConfiguration('lean4.infoview').get('showTooltipOnHover', true)
}

export function getInfoViewDisableLoadingSpinner(): boolean {
return workspace.getConfiguration('lean4.infoview').get('disableLoadingSpinner', false)
}

export function getElaborationDelay(): number {
return workspace.getConfiguration('lean4').get('elaborationDelay', 200)
}
Expand Down
2 changes: 2 additions & 0 deletions vscode-lean4/src/infoview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
getInfoViewAutoOpen,
getInfoViewAutoOpenShowsGoal,
getInfoViewDebounceTime,
getInfoViewDisableLoadingSpinner,
getInfoViewEmphasizeFirstGoal,
getInfoViewReverseTacticState,
getInfoViewShowExpectedType,
Expand Down Expand Up @@ -664,6 +665,7 @@ export class InfoProvider implements Disposable {
emphasizeFirstGoal: getInfoViewEmphasizeFirstGoal(),
reverseTacticState: getInfoViewReverseTacticState(),
showTooltipOnHover: getInfoViewShowTooltipOnHover(),
disableLoadingSpinner: getInfoViewDisableLoadingSpinner(),
})
}

Expand Down