-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
[forgive] Init #31918
Draft
poteto
wants to merge
4
commits into
main
Choose a base branch
from
pr31918
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,975
−51
Draft
[forgive] Init #31918
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,8 @@ dist | |
.spr.yml | ||
testfilter.txt | ||
|
||
bundle-oss.sh | ||
bundle-oss.sh | ||
|
||
# forgive | ||
*.vsix | ||
.vscode-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {defineConfig} from '@vscode/test-cli'; | ||
|
||
export default defineConfig({files: 'dist/test/**/*.test.js'}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
**/node_modules | ||
client | ||
server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ignore-engines true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Meta Platforms, Inc. and affiliates. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"private": "true", | ||
"name": "react-forgive-client", | ||
"version": "0.0.0", | ||
"description": "Experimental LSP client", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "echo 'no build'", | ||
"test": "echo 'no tests'" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/facebook/react.git", | ||
"directory": "compiler/packages/react-forgive" | ||
}, | ||
"dependencies": { | ||
"vscode-languageclient": "^9.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/vscode": "^1.95.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import * as path from 'path'; | ||
import {ExtensionContext, window as Window} from 'vscode'; | ||
|
||
import { | ||
LanguageClient, | ||
LanguageClientOptions, | ||
ServerOptions, | ||
TransportKind, | ||
} from 'vscode-languageclient/node'; | ||
|
||
let client: LanguageClient; | ||
|
||
export function activate(context: ExtensionContext) { | ||
const serverModule = context.asAbsolutePath(path.join('dist', 'server.js')); | ||
|
||
// If the extension is launched in debug mode then the debug server options are used | ||
// Otherwise the run options are used | ||
const serverOptions: ServerOptions = { | ||
run: { | ||
module: serverModule, | ||
transport: TransportKind.ipc, | ||
options: {cwd: process.cwd()}, | ||
}, | ||
debug: { | ||
module: serverModule, | ||
transport: TransportKind.ipc, | ||
options: {cwd: process.cwd()}, | ||
}, | ||
}; | ||
|
||
const clientOptions: LanguageClientOptions = { | ||
documentSelector: [ | ||
{scheme: 'file', language: 'javascriptreact'}, | ||
{scheme: 'file', language: 'typescriptreact'}, | ||
], | ||
progressOnInitialization: true, | ||
}; | ||
|
||
// Create the language client and start the client. | ||
try { | ||
client = new LanguageClient( | ||
'react-forgive', | ||
'React Analyzer', | ||
serverOptions, | ||
clientOptions, | ||
); | ||
} catch { | ||
Window.showErrorMessage( | ||
`React Analyzer couldn't be started. See the output channel for details.`, | ||
); | ||
return; | ||
} | ||
|
||
client.registerProposedFeatures(); | ||
client.start(); | ||
} | ||
|
||
export function deactivate(): Thenable<void> | undefined { | ||
if (client !== undefined) { | ||
return client.stop(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@types/vscode@^1.95.0": | ||
version "1.96.0" | ||
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.96.0.tgz#3181004bf25d71677ae4aacdd7605a3fd7edf08e" | ||
integrity sha512-qvZbSZo+K4ZYmmDuaodMbAa67Pl6VDQzLKFka6rq+3WUTY4Kro7Bwoi0CuZLO/wema0ygcmpwow7zZfPJTs5jg== | ||
|
||
balanced-match@^1.0.0: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" | ||
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== | ||
|
||
brace-expansion@^2.0.1: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" | ||
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== | ||
dependencies: | ||
balanced-match "^1.0.0" | ||
|
||
minimatch@^5.1.0: | ||
version "5.1.6" | ||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" | ||
integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== | ||
dependencies: | ||
brace-expansion "^2.0.1" | ||
|
||
semver@^7.3.7: | ||
version "7.6.3" | ||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" | ||
integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== | ||
|
||
[email protected]: | ||
version "8.2.0" | ||
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz#f43dfa35fb51e763d17cd94dcca0c9458f35abf9" | ||
integrity sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA== | ||
|
||
vscode-languageclient@^9.0.1: | ||
version "9.0.1" | ||
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-9.0.1.tgz#cdfe20267726c8d4db839dc1e9d1816e1296e854" | ||
integrity sha512-JZiimVdvimEuHh5olxhxkht09m3JzUGwggb5eRUkzzJhZ2KjCN0nh55VfiED9oez9DyF8/fz1g1iBV3h+0Z2EA== | ||
dependencies: | ||
minimatch "^5.1.0" | ||
semver "^7.3.7" | ||
vscode-languageserver-protocol "3.17.5" | ||
|
||
[email protected]: | ||
version "3.17.5" | ||
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz#864a8b8f390835572f4e13bd9f8313d0e3ac4bea" | ||
integrity sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg== | ||
dependencies: | ||
vscode-jsonrpc "8.2.0" | ||
vscode-languageserver-types "3.17.5" | ||
|
||
[email protected]: | ||
version "3.17.5" | ||
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz#3273676f0cf2eab40b3f44d085acbb7f08a39d8a" | ||
integrity sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "react-forgive", | ||
"displayName": "React Analyzer", | ||
"description": "React LSP", | ||
"license": "MIT", | ||
"version": "0.0.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/facebook/react.git", | ||
"directory": "compiler/packages/react-forgive" | ||
}, | ||
"categories": [ | ||
"Programming Languages" | ||
], | ||
"keywords": [ | ||
"react", | ||
"react analyzer", | ||
"react compiler" | ||
], | ||
"publisher": "Meta", | ||
"engines": { | ||
"vscode": "^1.75.0" | ||
}, | ||
"activationEvents": [ | ||
"onLanguage:javascriptreact", | ||
"onLanguage:typescriptreact" | ||
], | ||
"main": "./dist/extension.js", | ||
"contributes": { | ||
"commands": [ | ||
{ | ||
"command": "react-forgive.toggleAll", | ||
"title": "React Analyzer: Toggle on/off" | ||
} | ||
] | ||
}, | ||
"scripts": { | ||
"build": "yarn run compile", | ||
"compile": "rimraf dist && concurrently -n server,client \"yarn run esbuild:server --sourcemap\" \"yarn run esbuild:client --sourcemap\"", | ||
"dev": "yarn run package && yarn run install-ext", | ||
"esbuild:client": "esbuild ./client/src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node", | ||
"esbuild:server": "esbuild ./server/src/index.ts --bundle --outfile=dist/server.js --external:vscode --format=cjs --platform=node", | ||
"install-ext": "code --install-extension react-forgive-0.0.0.vsix", | ||
"lint": "echo 'no tests'", | ||
"package": "rm -f react-forgive-0.0.0.vsix && vsce package --yarn", | ||
"postinstall": "cd client && yarn install && cd ../server && yarn install && cd ..", | ||
"pretest": "yarn run compile && yarn run lint", | ||
"test": "vscode-test", | ||
"vscode:prepublish": "yarn run compile", | ||
"watch": "concurrently --kill-others -n server,client \"run esbuild:server --sourcemap --watch\" \"run esbuild:client --sourcemap --watch\"" | ||
}, | ||
"devDependencies": { | ||
"@eslint/js": "^9.13.0", | ||
"@types/mocha": "^10.0.10", | ||
"@types/node": "^20", | ||
"@types/vscode": "^1.96.0", | ||
"@vscode/test-cli": "^0.0.10", | ||
"@vscode/test-electron": "^2.4.1", | ||
"esbuild": "^0.24.0", | ||
"eslint": "^9.13.0", | ||
"mocha": "^11.0.1", | ||
"typescript-eslint": "^8.16.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"private": "true", | ||
"name": "react-forgive-server", | ||
"version": "0.0.0", | ||
"description": "Experimental LSP server", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "rimraf dist && rollup --config --bundleConfigAsCjs", | ||
"test": "echo 'no tests'" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/facebook/react.git", | ||
"directory": "compiler/packages/react-forgive" | ||
}, | ||
"dependencies": { | ||
"@babel/core": "^7.26.0", | ||
"@babel/parser": "^7.26.0", | ||
"@babel/plugin-syntax-typescript": "^7.25.9", | ||
"@babel/types": "^7.26.0", | ||
"cosmiconfig": "^9.0.0", | ||
"prettier": "^3.3.3", | ||
"vscode-languageserver": "^9.0.1", | ||
"vscode-languageserver-textdocument": "^1.0.12" | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just stumbled upon this PR by accident, but I can tell you from experience that you shouldn’t rely on
process.cwd()
in a VSCode extension or language server. It may vary based on which OS the user uses and how they opened their editor. It’ll cause all sorts of unexpected issues.