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

Making the extension compatible with the VSCode web version #21

Merged
merged 2 commits into from
Aug 31, 2021
Merged
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 @@ -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