-
Notifications
You must be signed in to change notification settings - Fork 60
Add WSO2 integrator #901
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
Add WSO2 integrator #901
Changes from 63 commits
f546c76
c02ef8d
20b0106
771070c
d76490c
77864b7
6a71aaa
a1fc49e
2d3a9bf
4af1d2a
40a63a2
164ba05
dc1f1d9
f986372
146906f
aba040c
00b0793
b43e816
0f16660
189f45d
6280c5b
b55f298
2cf0ab8
195f1e9
43dcd6b
a239a01
c5876ec
f5da3b4
bc2a2cd
f11af15
eaa8145
c708556
55c0b9f
7d6d438
2edac1c
b9906c5
a5344c9
a9858b4
820bb6a
46c9bb7
e518b1e
98f4aab
0b79b6d
eac7056
df8b0db
a9393b7
6831a9a
44ebf1b
fec6f55
ff93bdf
c0aeeb5
31db42e
7a3e9f6
1066a3c
852c401
b18201c
c963d82
637c9f6
d4632a4
cd4e45d
ed39df1
807b1f8
b7dd186
2102269
80b7526
70dad0c
e13cf7c
d2dcfa4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,27 +20,30 @@ import { SHARED_COMMANDS, BI_COMMANDS } from '@wso2/ballerina-core'; | |||||||||||||||||||||||
| import { ProjectExplorerEntry, ProjectExplorerEntryProvider } from './project-explorer-provider'; | ||||||||||||||||||||||||
| import { ExtensionContext, TreeView, commands, window, workspace } from 'vscode'; | ||||||||||||||||||||||||
| import { extension } from '../biExtentionContext'; | ||||||||||||||||||||||||
| import { BI_PROJECT_EXPLORER_VIEW_ID, WI_PROJECT_EXPLORER_VIEW_ID } from '../constants'; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| interface ExplorerActivationConfig { | ||||||||||||||||||||||||
| context: ExtensionContext; | ||||||||||||||||||||||||
| isBI: boolean; | ||||||||||||||||||||||||
| isBallerinaPackage?: boolean; | ||||||||||||||||||||||||
| isBallerinaWorkspace?: boolean; | ||||||||||||||||||||||||
| isEmptyWorkspace?: boolean; | ||||||||||||||||||||||||
| isInWI: boolean; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| export function activateProjectExplorer(config: ExplorerActivationConfig) { | ||||||||||||||||||||||||
| const { context, isBI, isBallerinaPackage, isBallerinaWorkspace, isEmptyWorkspace } = config; | ||||||||||||||||||||||||
| const { context, isBI, isBallerinaPackage, isBallerinaWorkspace, isEmptyWorkspace, isInWI } = config; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (extension.langClient && extension.biSupported) { | ||||||||||||||||||||||||
| setLoadingStatus(); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| const treeviewId = isInWI ? WI_PROJECT_EXPLORER_VIEW_ID : BI_PROJECT_EXPLORER_VIEW_ID; | ||||||||||||||||||||||||
| const projectExplorerDataProvider = new ProjectExplorerEntryProvider(); | ||||||||||||||||||||||||
| const projectTree = createProjectTree(projectExplorerDataProvider); | ||||||||||||||||||||||||
| const projectTree = createProjectTree(projectExplorerDataProvider, treeviewId); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (isBallerinaPackage || isBallerinaWorkspace) { | ||||||||||||||||||||||||
| registerBallerinaCommands(projectExplorerDataProvider, isBI, isBallerinaWorkspace, isEmptyWorkspace); | ||||||||||||||||||||||||
| registerBallerinaCommands(projectExplorerDataProvider, isBI, isInWI, isBallerinaWorkspace, isEmptyWorkspace); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| handleVisibilityChangeEvents( | ||||||||||||||||||||||||
|
|
@@ -57,13 +60,14 @@ function setLoadingStatus() { | |||||||||||||||||||||||
| commands.executeCommand('setContext', 'BI.status', 'loading'); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| function createProjectTree(dataProvider: ProjectExplorerEntryProvider) { | ||||||||||||||||||||||||
| return window.createTreeView(BI_COMMANDS.PROJECT_EXPLORER, { treeDataProvider: dataProvider }); | ||||||||||||||||||||||||
| function createProjectTree(dataProvider: ProjectExplorerEntryProvider, treeviewId: string) { | ||||||||||||||||||||||||
| return window.createTreeView(treeviewId, { treeDataProvider: dataProvider }); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| function registerBallerinaCommands( | ||||||||||||||||||||||||
| dataProvider: ProjectExplorerEntryProvider, | ||||||||||||||||||||||||
| isBI: boolean, | ||||||||||||||||||||||||
| isInWI: boolean, | ||||||||||||||||||||||||
| isBallerinaWorkspace?: boolean, | ||||||||||||||||||||||||
| isEmptyWorkspace?: boolean | ||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||
|
|
@@ -77,7 +81,7 @@ function registerBallerinaCommands( | |||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| if (isBI) { | ||||||||||||||||||||||||
| registerBICommands(); | ||||||||||||||||||||||||
| registerBICommands(isInWI); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -131,8 +135,9 @@ function handleNonBallerinaVisibility() { | |||||||||||||||||||||||
| commands.executeCommand(SHARED_COMMANDS.OPEN_BI_WELCOME); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| function registerBICommands() { | ||||||||||||||||||||||||
| commands.executeCommand(BI_COMMANDS.FOCUS_PROJECT_EXPLORER); | ||||||||||||||||||||||||
| function registerBICommands(isInWI) { | ||||||||||||||||||||||||
| const treeViewId = isInWI ? WI_PROJECT_EXPLORER_VIEW_ID : BI_PROJECT_EXPLORER_VIEW_ID; | ||||||||||||||||||||||||
| commands.executeCommand(`${treeViewId}.focus`); | ||||||||||||||||||||||||
| commands.executeCommand(SHARED_COMMANDS.SHOW_VISUALIZER); | ||||||||||||||||||||||||
| commands.executeCommand('setContext', 'BI.project', true); | ||||||||||||||||||||||||
|
Comment on lines
+160
to
164
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Add missing type annotation for The parameter lacks a TypeScript type annotation, which is inconsistent with the rest of the file and may reduce type safety. -function registerBICommands(isInWI) {
+function registerBICommands(isInWI: boolean) {
const treeViewId = isInWI ? WI_PROJECT_EXPLORER_VIEW_ID : BI_PROJECT_EXPLORER_VIEW_ID;
commands.executeCommand(`${treeViewId}.focus`);
commands.executeCommand(SHARED_COMMANDS.SHOW_VISUALIZER);
commands.executeCommand('setContext', 'BI.project', true);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -324,14 +324,14 @@ const handlerFunction = handlerSourceFile.addFunction({ | |||||
| }] | ||||||
| }); | ||||||
| handleImportStatment(handlerSourceFile, 'vscode-messenger', 'Messenger'); | ||||||
|
|
||||||
| // Add statements to the function | ||||||
| const managerObject = `const rpcManger = new ${managerClassName}();` | ||||||
| handlerFunction.addStatements(managerObject); | ||||||
| typeMethods.forEach(value => { | ||||||
| handleMessengerTypes(handlerFunction, value, handlerSourceFile); | ||||||
| }) | ||||||
|
|
||||||
| console.log(`Adding handler function: ${headerComment}...`); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix incorrect variable in log message. The log message uses Apply this diff to fix the log message: -console.log(`Adding handler function: ${headerComment}...`);
+console.log(`Adding handler function: ${handlerName}...`);The 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| handleImportStatment(handlerSourceFile, './rpc-manager', managerClassName); | ||||||
|
|
||||||
| // Format imports into new lines | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.