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

updated multi-root support with a more native impl #125

Open
wants to merge 1 commit into
base: main
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ meta.json
stats.html
server
test/result
*.bazel.lock
74 changes: 40 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,6 @@
{
"id": "bazelTaskOutline",
"name": "Bazel Run Targets"
},
{
"id": "rootFileViewer",
"name": "Project Root (Files)",
"when": "isMultiRoot"
}
]
},
Expand Down Expand Up @@ -333,7 +328,7 @@
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vscode/test-electron": "^2.3.4",
"@vscode/vsce": "^3.0.0",
"@vscode/vsce": "^3.2.1",
"esbuild": "0.19.8",
"esbuild-plugin-eslint": "^0.3.7",
"esbuild-visualizer": "^0.4.1",
Expand Down
5 changes: 0 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import { ProjectViewManager } from './projectViewManager';
import { BazelRunTargetProvider } from './provider/bazelRunTargetProvider';
import { BazelTaskProvider } from './provider/bazelTaskProvider';
import { RootFileViewProvider } from './provider/rootFileViewProvider';
import {
getWorkspaceRoot,
initBazelProjectFile,
Expand All @@ -46,10 +45,6 @@
BazelRunTargetProvider.instance
);
tasks.registerTaskProvider('bazel', new BazelTaskProvider());
window.registerTreeDataProvider(
'rootFileViewer',
RootFileViewProvider.instance
);

BazelLanguageServerTerminal.trace('extension activated');

Expand Down Expand Up @@ -144,7 +139,7 @@
registerLSClient();
}

export function deactivate() { }

Check warning on line 142 in src/extension.ts

View workflow job for this annotation

GitHub Actions / Build and Test (OS ubuntu-latest)

Delete `·`

Check warning on line 142 in src/extension.ts

View workflow job for this annotation

GitHub Actions / Build and Test (OS macos-latest)

Delete `·`

function syncProjectView(): void {
if (!isRedhatJavaReady()) {
Expand Down
16 changes: 12 additions & 4 deletions src/projectViewManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ export namespace ProjectViewManager {
extensions: await getVscodeConfig('extensions'),
};
writeFileSync(
`${workspaceRoot}/${workspaceRootName}.code-workspace`,
`${workspaceRoot}/workspace.code-workspace`,
Buffer.from(JSON.stringify(workspaceFile, null, 2))
);

// cleanup all old single root workspace files
await workspace.fs.delete(Uri.file(`${workspaceRoot}/.vscode`), {
recursive: true,
});

// reload the window using the new workspace
commands.executeCommand(
'vscode.openFolder',
Uri.file(`${workspaceRoot}/${workspaceRootName}.code-workspace`)
Uri.file(`${workspaceRoot}/workspace.code-workspace`)
);
}
return;
Expand Down Expand Up @@ -77,6 +82,9 @@ export namespace ProjectViewManager {

async function getDisplayFolders(): Promise<string[]> {
let displayFolders = new Set<string>(['.eclipse']); // TODO bubble this out to a setting
if (isMultiRoot()) {
displayFolders.add('.');
}
lonhutt marked this conversation as resolved.
Show resolved Hide resolved
try {
const bazelProjectFile = await getBazelProjectFile();
if (bazelProjectFile.directories.includes('.')) {
Expand Down Expand Up @@ -164,11 +172,11 @@ export namespace ProjectViewManager {
k.includes('.eclipse')
).length;

const viewAll = displayFolders.includes('.');
const viewAll = displayFolders.includes('.') && !isMultiRoot();

const fileWatcherExcludePattern = viewAll
? ''
: `**/!(${Array.from(displayFolders.sort()).join('|')})/**`;
: `**/!(${Array.from(displayFolders.filter((s) => s !== '.').sort()).join('|')})/**`;

if (viewAll) {
// if viewAll and existing config doesn't contain .eclipse return
Expand Down
76 changes: 0 additions & 76 deletions src/provider/rootFileViewProvider.ts

This file was deleted.

Loading