Skip to content

Commit 225412f

Browse files
committed
split out sync from java sync
rm old settings cleanup
1 parent dfb9117 commit 225412f

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/extension.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,19 @@ export function deactivate() {}
148148

149149
function toggleBazelProjectSyncStatus(doc: TextDocument) {
150150
if (workspace.getConfiguration('bazel.projectview').get('notification')) {
151+
152+
// check
153+
const options = (getJavaExtension()) ? ['Sync View', 'Sync Java', 'Do Nothing'] : ['Sync View', 'Do Nothing'];
154+
151155
window
152156
.showWarningMessage(
153-
`The Bazel Project View changed. Do you want to synchronize?`,
154-
...['Sync', 'Do Nothing']
157+
`The Bazel Project View changed. Do you want to synchronize?`, ...options
155158
)
156159
.then((val) => {
157-
if (val === 'Sync') {
160+
if (val === 'Sync View') {
158161
syncProjectView();
162+
} else if(val === 'Sync Java') {
163+
syncJava();
159164
} else if (val === 'Do Nothing') {
160165
workspace
161166
.getConfiguration('bazel.projectview')
@@ -185,12 +190,19 @@ function openBazelProjectFile() {
185190
function syncProjectView(){
186191
outputLog.info('syncing project');
187192
ProjectViewManager.updateProjectView();
193+
}
188194

189-
// if bazel-vscode-java extension exists, execute it's sync method
190-
const bazelJavaExtension = extensions.getExtension<BazelExtensionPlugin>('sfdc.bazel-vscode-java')
191-
if( bazelJavaExtension ){
195+
function getJavaExtension(){
196+
return extensions.getExtension<BazelExtensionPlugin>('sfdc-eng.bazel-java');
197+
}
198+
199+
/**
200+
* Run sync against the eclipse LS
201+
*/
202+
function syncJava(){
203+
const bazelJavaExtension = getJavaExtension();
204+
if(bazelJavaExtension) {
192205
outputLog.info('syncing java project')
193-
bazelJavaExtension.exports.sync()
206+
bazelJavaExtension.exports.sync();
194207
}
195-
196208
}

src/projectViewManager.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ export namespace ProjectViewManager {
4747
JSON.stringify(workspaceFile, null, 2)
4848
);
4949

50-
// cleanup all old single root workspace files
51-
await workspace.fs.delete(Uri.file(`${workspaceRoot}/.vscode`), {
52-
recursive: true,
53-
});
54-
5550
// reload the window using the new workspace
5651
commands.executeCommand(
5752
'vscode.openFolder',
@@ -152,7 +147,7 @@ export namespace ProjectViewManager {
152147
} else {
153148
return {
154149
uri: Uri.file(`${workspaceRoot}/${f}`),
155-
name: f.replaceAll(sep, ' ⇾ '),
150+
name: f === '.' ? workspaceRootName : f.replaceAll(sep, ' ⇾ '),
156151
};
157152
}
158153
})

0 commit comments

Comments
 (0)