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

added info window popup to project view change event #69

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
"default": true,
"description": "Open the Bazel Project View file on extension activation",
"scope": "window"
},
"bazel.projectview.notification": {
"type": "boolean",
"default": true,
"description": "Display 'sync project view' notification info window on .bazelproject edit",
"scope": "window"
}
}
},
Expand Down
28 changes: 23 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function activate(context: ExtensionContext) {
openBazelProjectFile();
showBazelprojectConfig.update('open', false); // only open this file on the first activation of this extension
}
syncBazelProjectView();
syncProjectViewDirectories();
context.subscriptions.push(
commands.registerCommand(Commands.OPEN_BAZEL_PROJECT_FILE, () =>
openBazelProjectFile()
Expand All @@ -106,7 +106,7 @@ export async function activate(context: ExtensionContext) {
context.subscriptions.push(
commands.registerCommand(
Commands.SYNC_DIRECTORIES_ONLY,
syncBazelProjectView
syncProjectViewDirectories
)
);
context.subscriptions.push(
Expand Down Expand Up @@ -154,7 +154,7 @@ function syncProjectView(): void {

projectViewStatus.hide();
executeJavaLanguageServerCommand(Commands.SYNC_PROJECTS).then(
syncBazelProjectView
syncProjectViewDirectories
);
}

Expand Down Expand Up @@ -220,14 +220,32 @@ function toggleBazelClasspathSyncStatus(doc: TextDocument) {
}

function toggleBazelProjectSyncStatus(doc: TextDocument) {
if (workspace.getConfiguration('bazel.projectview').get('notification')) {
window
.showInformationMessage(
`Project View Updated [details](https://github.com/salesforce/bazel-eclipse/blob/main/docs/common/projectviews.md#supported-features)`,
...['Sync Project View', 'Sync Directories Only', 'Do Not Show Again']
)
.then((val) => {
if (val === 'Sync Project View') {
syncProjectView();
} else if (val === 'Sync Directories Only') {
syncProjectViewDirectories();
} else if (val === 'Do Not Show Again') {
workspace
.getConfiguration('bazel.projectview')
.update('notification', false);
}
});
}
projectViewStatus.show();
projectViewStatus.text = 'Sync bazel project view';
projectViewStatus.text = 'Sync Project View';
projectViewStatus.backgroundColor = new ThemeColor(
'statusBarItem.warningBackground'
);
}

async function syncBazelProjectView() {
async function syncProjectViewDirectories() {
if (workspaceRoot) {
BazelLanguageServerTerminal.debug('Syncing bazel project view');
const displayFolders = new Set<string>(['.eclipse', '.vscode']); // TODO bubble this out to a setting
Expand Down