Skip to content

Commit

Permalink
Merge pull request #21 from saltudelft/vsc-web
Browse files Browse the repository at this point in the history
Making the extension compatible with the VSCode web version
  • Loading branch information
mir-am authored Aug 31, 2021
2 parents 7b80c6a + 51cf6d0 commit c8eb8c6
Show file tree
Hide file tree
Showing 10 changed files with 8,708 additions and 3,741 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ dist
node_modules
out
.vscode-test/
.vscode-test-web/
*.vsix
.DS_Store
17 changes: 16 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "npm: test-compile"
}
},
{
"name": "Run Web Extension in VS Code",
"type": "pwa-extensionHost",
"debugWebWorkerHost": true,
"request": "launch",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionDevelopmentKind=web"
],
"outFiles": [
"${workspaceFolder}/dist/web/**/*.js"
],
"preLaunchTask": "npm: watch-web"
}
]
}
10 changes: 9 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
"kind": "build",
"isDefault": true
}
}
},
{
"type": "npm",
"script": "watch-web",
"group": "build",
"isBackground": true,
"problemMatcher": "$ts-webpack-watch"

}
]
}
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ This extension provides machine learning-based type autocompletion for Python, w
> **Tip:** You can also enable automatic type inference when opening Python files. To do so, see [settings](#settings).
> **Tip:** The same above steps are also applicable to the web version of the extension.
## Considerations
- Do not edit the selected source file after running the Type4Py extension. That is, add the relevant predicted types to the code, save the file and then edit as you wish. We will drop this consideration once the [caching solution](#roadmap) is implemented.
- Make sure that the selected source file does not have syntax or parse errors before running the extension. In VSCode, Python linters warn about such errors.
Expand All @@ -47,7 +49,7 @@ This extension provides machine learning-based type autocompletion for Python, w
# Installation
> **NOTE:** Update VSCode before installing the extension.
The latest version of the extension can be installed from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=saltud.type4py).
The latest version of the extension can be installed from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=saltud.type4py). The extension is also compatible with the **web version** of VSCode.

# Settings
| Name | Description | Default |
Expand Down Expand Up @@ -84,6 +86,14 @@ External contributions are welcome such as bug fixes and improvements! Feel free
1. Make sure that all instances of VSCode are closed on the machine.
2. Run `npm run test-compile`

## Web version
To develop and test the web version of the extension, run the following commands at the root of the project:
```
npm install && npm run compile-web
npx vscode-test-web --browserType=chromium --extensionDevelopmentPath=.
```
This opens up the VSCode Web at `localhost:3000` with the extension.

# Roadmap
Here are the desirable features for future releases.
- Implementing a caching solution to preserve type predictions when source files change.
Expand Down
Loading

0 comments on commit c8eb8c6

Please sign in to comment.