Skip to content

Theia with Checker Framework Plugin #1

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

Open
wants to merge 2 commits 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
15 changes: 12 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
node_modules
.browser_modules

lib
*.log

*-app/*
!*-app/package.json
yarn.lock
lsp4xml/org.eclipse.lsp4xml-all.jar

dist/
node_modules/
*.theia
lsp4xml/org.eclipse.lsp4xml-all.jar
yarn.lock
.vscode
62 changes: 57 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,59 @@
# checker-framework-theia
checker-framework-theia Plugin example for Theia.
# Checker Framework Theia
## Getting started
1. Install yarn
```
npm install -g yarn
```

# References
2. Run the setup script
```
yarn run setup
```

- [Checker Framework Language Server](https://github.com/eisopux/checker-framework-languageserver)
- [Authoring Theia Plug-ins](https://theia-ide.org/docs/authoring_plugins)
3. Build the packages
```
yarn run prepare
```

Now, the node_modules should be installed and the Theia packages should be setup and ready for development.
## Running it in the Browser
1. Rebuild it for the browser
```
yarn run rebuild:browser
```

2. Start it for the browser
```
yarn run start:browser
```

Open http://localhost:3000 in the browser and the Theia application should appear.

## Running it in Electron
1. Rebuild it for Electron
```
yarn run rebuild:electron
```

1. Start it for Electron
```
yarn run start:electron
```

The Electron app should open.

## Folder Structure
### browser-app
This folder contains the npm package for the Browser Application of Theia.

### checkerframeworkdemo
This folder contains the npm package for the Checker Framework Demo extensions for Theia.

### electron-app
This folder contains the npm package for the Electron Application of Theia.

### plugins
This folder contains the VSCode plugins incuded in the Theia IDE. It includes the following plugins:

- Checker Framework
- Java
32 changes: 32 additions & 0 deletions browser-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"private": true,
"name": "browser-app",
"version": "0.0.0",
"dependencies": {
"@theia/core": "latest",
"@theia/editor": "latest",
"@theia/filesystem": "latest",
"@theia/markers": "latest",
"@theia/messages": "latest",
"@theia/monaco": "latest",
"@theia/navigator": "latest",
"@theia/plugin-ext": "latest",
"@theia/plugin-ext-vscode": "latest",
"@theia/preferences": "latest",
"@theia/process": "latest",
"@theia/terminal": "latest",
"@theia/workspace": "latest",
"checkerframeworkdemo": "0.0.0"
},
"devDependencies": {
"@theia/cli": "latest"
},
"scripts": {
"prepare": "theia build --mode development",
"start": "theia start --plugins=local-dir:../plugins",
"watch": "theia build --watch --mode development"
},
"theia": {
"target": "browser"
}
}
9 changes: 9 additions & 0 deletions checkerframeworkdemo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Checker Framework Demo Extension
This is the npm package for extending the Theia IDE for the demo page. It does the following:

- Remove the About menu and command
- Remove the Help menu
- Remove the Terminal menu
- Remove the File menu

These can be further extended to customize the Theia IDE. Some information can be found in the [Authoring Extensions](https://theia-ide.org/docs/authoring_extensions) docs for Theia.
29 changes: 29 additions & 0 deletions checkerframeworkdemo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "checkerframeworkdemo",
"keywords": [
"theia-extension"
],
"version": "0.0.0",
"files": [
"lib",
"src"
],
"dependencies": {
"@theia/core": "latest"
},
"devDependencies": {
"rimraf": "latest",
"typescript": "latest"
},
"scripts": {
"prepare": "yarn run clean && yarn run build",
"clean": "rimraf lib",
"build": "tsc",
"watch": "tsc -w"
},
"theiaExtensions": [
{
"frontend": "lib/browser/checkerframeworkdemo-frontend-module"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { injectable } from "inversify";
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry } from "@theia/core/lib/common";
import { CommonMenus, CommonCommands } from "@theia/core/lib/browser";
// import { WorkspaceCommands } from "@theia/workspace/lib/browser";
import { TerminalMenus } from "@theia/terminal/lib/browser/terminal-frontend-contribution";

// Remove Menus
export const RemoveMenuCommand = {
id: 'CheckerFrameworkDemo.removeMenu'
};

@injectable()
export class RemoveMenuContribution implements CommandContribution, MenuContribution {

constructor() { }

registerCommands(registry: CommandRegistry): void {
// Help
registry.unregisterCommand(CommonCommands.ABOUT_COMMAND);

// File
// registry.unregisterCommand(WorkspaceCommands.NEW_FILE);
// registry.unregisterCommand(WorkspaceCommands.NEW_FOLDER);
// registry.unregisterCommand(WorkspaceCommands.OPEN);
// registry.unregisterCommand(WorkspaceCommands.OPEN_WORKSPACE);
// registry.unregisterCommand(WorkspaceCommands.OPEN_RECENT_WORKSPACE);
// registry.unregisterCommand(WorkspaceCommands.SAVE_WORKSPACE_AS);
// registry.unregisterCommand(WorkspaceCommands.SAVE_AS);
// registry.unregisterCommand(WorkspaceCommands.SAVE_WORKSPACE_AS);
// registry.unregisterCommand(WorkspaceCommands.CLOSE);
}

registerMenus(menus: MenuModelRegistry): void {
menus.unregisterMenuAction(CommonMenus.HELP.slice(-1)[0]);

menus.unregisterMenuAction(CommonMenus.FILE.slice(-1)[0]);
menus.unregisterMenuAction(CommonMenus.FILE_SETTINGS_SUBMENU.slice(-1)[0]);

menus.unregisterMenuAction(TerminalMenus.TERMINAL.slice(-1)[0]);

// Add settings sub menu to Edit
menus.registerSubmenu(CommonMenus.FILE_SETTINGS_SUBMENU, 'Settings');
}
}

// dummy class to remove terminal
// @injectable()
// export class TerminalFrontendContributionStub {
// registerMenus(): void {}
// registerCommands(): void {}
// }

// @injectable()
// export class TaskFrontendContributionStub {
// registerMenus(): void {}
// registerCommands(): void {}
// onStart(): void {}
// onStop(): void {}
// updateRunningTasksItem(): void {}
// registerQuickOpenHandlers(): void {}
// registerKeybindings(): void {}
// }
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Generated using theia-extension-generator
*/
import {
RemoveMenuContribution,
// TerminalFrontendContributionStub,
// TaskFrontendContributionStub
} from './checkerframeworkdemo-contribution';
import {
CommandContribution,
MenuContribution
} from "@theia/core/lib/common";
// import { TerminalFrontendContribution } from '@theia/terminal/lib/browser/terminal-frontend-contribution';
// import { TaskFrontendContribution } from '@theia/task/lib/browser/task-frontend-contribution';
import { ContainerModule } from "inversify";

export default new ContainerModule(bind => {
// enable/disable certain menus
bind(CommandContribution).to(RemoveMenuContribution);
bind(MenuContribution).to(RemoveMenuContribution);
// bind(TerminalFrontendContribution).to(TerminalFrontendContributionStub);
// bind(TaskFrontendContribution).to(TaskFrontendContributionStub);
});
19 changes: 12 additions & 7 deletions tsconfig.json → checkerframeworkdemo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
{
"compilerOptions": {
"strict": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"declaration": true,
"declarationMap": true,
"noImplicitAny": true,
"noEmitOnError": false,
"noImplicitThis": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"downlevelIteration": true,
"resolveJsonModule": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es6",
"target": "es5",
"jsx": "react",
"lib": [
"es6",


"webworker"

"dom"
],
"sourceMap": true,
"rootDir": "src",
Expand Down
33 changes: 33 additions & 0 deletions electron-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"private": true,
"name": "electron-app",
"version": "0.0.0",
"dependencies": {
"@theia/core": "latest",
"@theia/editor": "latest",
"@theia/electron": "latest",
"@theia/filesystem": "latest",
"@theia/markers": "latest",
"@theia/messages": "latest",
"@theia/monaco": "latest",
"@theia/navigator": "latest",
"@theia/plugin-ext": "latest",
"@theia/plugin-ext-vscode": "latest",
"@theia/preferences": "latest",
"@theia/process": "latest",
"@theia/terminal": "latest",
"@theia/workspace": "latest",
"checkerframeworkdemo": "0.0.0"
},
"devDependencies": {
"@theia/cli": "latest"
},
"scripts": {
"prepare": "theia build --mode development",
"start": "theia start --plugins=local-dir:../plugins",
"watch": "theia build --watch --mode development"
},
"theia": {
"target": "electron"
}
}
11 changes: 11 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"lerna": "2.4.0",
"version": "0.0.0",
"useWorkspaces": true,
"npmClient": "yarn",
"command": {
"run": {
"stream": true
}
}
}
40 changes: 0 additions & 40 deletions lib/checker-framework-theia-backend.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/checker-framework-theia-backend.js.map

This file was deleted.

Loading