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

Statusbar update 212 952 1189 #1200

Merged
merged 34 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
852e287
removed unused warning button
Apr 21, 2020
b367244
statusbar update: now uses classes
Apr 23, 2020
3ecb255
added settings
SchweizS Apr 23, 2020
01b1748
refactoring: readability
SchweizS Apr 23, 2020
efd0f80
added color setting to ctest button
SchweizS Apr 23, 2020
f8a1243
Merge branch 'develop' into statusbar-update_212_952_1189
andreeis Apr 24, 2020
9153572
addressed change requests
SchweizS Apr 25, 2020
dbe2991
readded hideDebug/LaunchCommand functions to status
SchweizS Apr 25, 2020
a0c8cd0
rename: settings -> settingsName
SchweizS Apr 30, 2020
9523789
removed getDefaultType
SchweizS Apr 30, 2020
2b5adb2
protected getType -> private _getType
SchweizS Apr 30, 2020
35c4380
fixed button order
SchweizS Apr 30, 2020
de40098
typecheck on text length
SchweizS Apr 30, 2020
798e21c
hide Status and targets in icon mode
SchweizS May 4, 2020
905431d
changed loca of Launch button
SchweizS May 4, 2020
1f93be7
refactoring for readability
SchweizS May 4, 2020
33b1a73
fix: ctest coloring now needs true to use colors
SchweizS May 4, 2020
a93e509
config update:
SchweizS May 4, 2020
a3d6da2
added loca and default values to advanced settings
SchweizS May 4, 2020
33e8c8d
added proper typecheck to kit length
SchweizS May 4, 2020
8cbef1a
added target tooltip to Build, Launch and Debug
SchweizS May 4, 2020
226c4e6
refactoring
SchweizS May 5, 2020
91e2bec
improved compact mode of status button
SchweizS May 5, 2020
008cb13
improved launch target selection
SchweizS May 5, 2020
9f6be09
improved compact mode of ctest button
SchweizS May 5, 2020
d8cba03
added target to build, debug and launch buttons
SchweizS May 5, 2020
b6a7571
clang-tidy
SchweizS May 5, 2020
8209fe8
added missing type annotations
SchweizS May 5, 2020
cfc9ffb
loca update
SchweizS May 6, 2020
4803f54
tooltip update
SchweizS May 6, 2020
bae00e4
finalizing for release
SchweizS May 7, 2020
f14d29d
active workspace -> active folder
SchweizS May 8, 2020
6d4e4db
removed autoSelect note from active folder
SchweizS May 11, 2020
9e2736b
Merge branch 'develop' into statusbar-update_212_952_1189
bobbrow May 11, 2020
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
164 changes: 164 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,170 @@
],
"scope": "window"
},
"cmake.statusbar.visibility": {
"type": "string",
"default": "default",
"description": "%cmake-tools.configuration.cmake.statusbar.visibility.description%",
"enum": [
"default",
"compact",
"icon",
"hidden"
],
"scope": "window"
},
"cmake.statusbar.advanced": {
"type": "object",
"default": {},
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.description%",
"properties": {
"kit": {
"type": "object",
"properties": {
"visibility": {
"type": "string",
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.visibility.description%",
"enum": [
"default",
"compact",
"icon",
"hidden"
]
},
"length": {
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.length.description%",
"type": "integer",
"default": 20
}
}
},
"status": {
"type": "object",
"properties": {
"visibility": {
"type": "string",
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.visibility.description%",
"enum": [
"default",
"compact",
"icon",
"hidden"
]
}
}
},
"workspace": {
"type": "object",
"properties": {
"visibility": {
"type": "string",
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.visibility.description%",
"enum": [
"default",
"compact",
"icon",
"hidden"
]
}
}
},
"buildTarget": {
"type": "object",
"properties": {
"visibility": {
"type": "string",
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.visibility.description%",
"enum": [
"default",
"compact",
"icon",
"hidden"
]
}
}
},
"build": {
"type": "object",
"properties": {
"visibility": {
"type": "string",
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.visibility.description%",
"enum": [
"default",
"compact",
"icon",
"hidden"
]
}
}
},
"launchTarget": {
"type": "object",
"properties": {
"visibility": {
"type": "string",
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.visibility.description%",
"enum": [
"default",
"compact",
"icon",
"hidden"
]
}
}
},
"debug": {
"type": "object",
"properties": {
"visibility": {
"type": "string",
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.visibility.description%",
"enum": [
"default",
"compact",
"icon",
"hidden"
]
}
}
},
"launch": {
"type": "object",
"properties": {
"visibility": {
"type": "string",
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.visibility.description%",
"enum": [
"default",
"compact",
"icon",
"hidden"
]
}
}
},
"ctest": {
"type": "object",
"properties": {
"visibility": {
"type": "string",
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.visibility.description%",
"enum": [
"default",
"compact",
"icon",
"hidden"
]
},
"color": {
"type":"boolean",
"default": false,
"description": "%cmake-tools.configuration.cmake.statusbar.advanced.ctest.color.description%"
}
}
}
}
},
"cmake.revealLog": {
"type": "string",
"default": "always",
Expand Down
5 changes: 5 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@
"cmake-tools.configuration.cmake.outputLogEncoding.description": "Encoding of the output from external commands (eg.cmake -- build).",
"cmake-tools.configuration.cmake.enableTraceLogging.description": "Enable trace logging to file and console (very noisy).",
"cmake-tools.configuration.cmake.autoSelectActiveFolder.description": "Select active folder automatically",
"cmake-tools.configuration.cmake.statusbar.visibility.description": "Configures how the extension displays the buttons in the status bar",
"cmake-tools.configuration.cmake.statusbar.advanced.description": "Configures the settings for individual status bar buttons. These settings overwrite the more general 'cmake.statusbar.visibility' setting.",
"cmake-tools.configuration.cmake.statusbar.advanced.visibility.description": "Configures how the extension displays this button in the status bar",
"cmake-tools.configuration.cmake.statusbar.advanced.ctest.color.description": "Enables a change in color for this button depending on test results",
"cmake-tools.configuration.cmake.statusbar.advanced.length.description": "Configures the maximum length of visible text in 'compact' mode.",
"cmake-tools.configuration.views.cmake.folders.description": "Folders",
"cmake-tools.configuration.views.cmake.outline.description": "Project Outline"
}
43 changes: 43 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,48 @@ export type LogLevelKey = 'trace'|'debug'|'info'|'note'|'warning'|'error'|'fatal

export type CMakeCommunicationMode = 'legacy'|'serverApi'|'fileApi'|'automatic';

export type StatusBarButtonVisibility = "default" | "compact" | "icon" | "hidden";

interface HardEnv {
[key: string]: string;
}

export interface AdvancedStatusBarConfig {
kit?: {
visibility?: StatusBarButtonVisibility;
length?: number;
};
status?: {
visibility?: StatusBarButtonVisibility;
};
workspace?: {
visibility?: StatusBarButtonVisibility;
};
buildTarget?: {
visibility?: StatusBarButtonVisibility;
};
build?: {
visibility?: StatusBarButtonVisibility;
};
launchTarget?: {
visibility?: StatusBarButtonVisibility;
};
debug?: {
visibility?: StatusBarButtonVisibility;
};
launch?: {
visibility?: StatusBarButtonVisibility;
};
ctest?: {
color?: boolean;
visibility?: StatusBarButtonVisibility;
};
}
export interface StatusBarConfig {
advanced?: AdvancedStatusBarConfig;
visibility: StatusBarButtonVisibility;
}

export interface ExtensionConfigurationSettings {
autoSelectActiveFolder: boolean;
cmakePath: string;
Expand Down Expand Up @@ -65,6 +103,7 @@ export interface ExtensionConfigurationSettings {
outputLogEncoding: string;
enableTraceLogging: boolean;
loggingLevel: LogLevelKey;
statusbar: StatusBarConfig;
}

type EmittersOf<T> = {
Expand All @@ -85,6 +124,8 @@ export class ConfigurationReader implements vscode.Disposable {

get configData() { return this._configData; }

get statusbar() { return this._configData.statusbar; }

dispose() {
if (this._updateSubscription) {
this._updateSubscription.dispose();
Expand Down Expand Up @@ -290,6 +331,8 @@ export class ConfigurationReader implements vscode.Disposable {
outputLogEncoding: new vscode.EventEmitter<string>(),
enableTraceLogging: new vscode.EventEmitter<boolean>(),
loggingLevel: new vscode.EventEmitter<LogLevelKey>(),
statusbar: new vscode.EventEmitter<StatusBarConfig>()

};

/**
Expand Down
13 changes: 7 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type CMakeToolsQueryMapFn = (cmt: CMakeTools) => Thenable<string | string[] | nu
class ExtensionManager implements vscode.Disposable {
constructor(public readonly extensionContext: vscode.ExtensionContext) {
telemetry.activate();
this._statusBar.targetName = 'all';
this._statusBar.setBuildTargetName('all');
this._folders.onAfterAddFolder(async cmtFolder => {
console.assert(this._folders.size === vscode.workspace.workspaceFolders?.length);
if (this._folders.size === 1) {
Expand Down Expand Up @@ -183,7 +183,7 @@ class ExtensionManager implements vscode.Disposable {
/**
* The status bar controller
*/
private readonly _statusBar = new StatusBar();
private readonly _statusBar = new StatusBar(this._workspaceConfig);
// Subscriptions for status bar items:
private _statusMessageSub: vscode.Disposable = new DummyDisposable();
private _targetNameSub: vscode.Disposable = new DummyDisposable();
Expand Down Expand Up @@ -389,7 +389,7 @@ class ExtensionManager implements vscode.Disposable {
} else if (!ws) {
// When adding a folder but the focus is on somewhere else
// Do nothing but make sure we are showing the active folder correctly
this._statusBar.reloadVisibility();
this._statusBar.update();
}
}
}
Expand Down Expand Up @@ -520,14 +520,14 @@ class ExtensionManager implements vscode.Disposable {
this._statusBar.setVisible(true);
this._statusMessageSub = cmt.onStatusMessageChanged(FireNow, s => this._statusBar.setStatusMessage(s));
this._targetNameSub = cmt.onTargetNameChanged(FireNow, t => {
this._statusBar.targetName = t;
this._statusBar.setBuildTargetName(t);
});
this._buildTypeSub = cmt.onBuildTypeChanged(FireNow, bt => this._statusBar.setBuildTypeLabel(bt));
this._launchTargetSub = cmt.onLaunchTargetNameChanged(FireNow, t => {
this._statusBar.setLaunchTargetName(t || '');
});
this._ctestEnabledSub = cmt.onCTestEnabledChanged(FireNow, e => this._statusBar.ctestEnabled = e);
this._testResultsSub = cmt.onTestResultsChanged(FireNow, r => this._statusBar.testResults = r);
this._ctestEnabledSub = cmt.onCTestEnabledChanged(FireNow, e => this._statusBar.setCTestEnabled(e));
this._testResultsSub = cmt.onTestResultsChanged(FireNow, r => this._statusBar.setTestResults(r));
this._isBusySub = cmt.onIsBusyChanged(FireNow, b => this._statusBar.setIsBusy(b));
this._statusBar.setActiveKitName(cmt.activeKit ? cmt.activeKit.name : '');
}
Expand Down Expand Up @@ -877,6 +877,7 @@ class ExtensionManager implements vscode.Disposable {

async hideLaunchCommand(shouldHide: boolean = true) {
// Don't hide command selectLaunchTarget here since the target can still be useful, one example is ${command:cmake.launchTargetPath} in launch.json
this._statusBar.hideLaunchButton(shouldHide);
bobbrow marked this conversation as resolved.
Show resolved Hide resolved
await util.setContextValue(HIDE_LAUNCH_COMMAND_KEY, shouldHide);
}

Expand Down
Loading