-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try all
path
, consider useBundled
import strategy
- Loading branch information
1 parent
3b56f9a
commit 9a2654b
Showing
2 changed files
with
96 additions
and
35 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,67 @@ | ||
import * as path from "path"; | ||
|
||
const folderName = path.basename(__dirname); | ||
|
||
/** | ||
* Path to the root directory of this extension. | ||
*/ | ||
export const EXTENSION_ROOT_DIR = | ||
folderName === "common" ? path.dirname(path.dirname(__dirname)) : path.dirname(__dirname); | ||
|
||
/** | ||
* Name of the `ruff` binary based on the current platform. | ||
*/ | ||
export const RUFF_BINARY_NAME = process.platform == "win32" ? "ruff.exe" : "ruff"; | ||
|
||
/** | ||
* Path to the directory containing the bundled Python scripts. | ||
*/ | ||
export const BUNDLED_PYTHON_SCRIPTS_DIR = path.join(EXTENSION_ROOT_DIR, "bundled"); | ||
export const SERVER_SCRIPT_PATH = path.join(BUNDLED_PYTHON_SCRIPTS_DIR, "tool", `server.py`); | ||
|
||
/** | ||
* Path to the `ruff` executable that is bundled with the extension. | ||
*/ | ||
export const BUNDLED_RUFF_EXECUTABLE = path.join( | ||
BUNDLED_PYTHON_SCRIPTS_DIR, | ||
"libs", | ||
"bin", | ||
RUFF_BINARY_NAME, | ||
); | ||
|
||
/** | ||
* Path to the Python script that starts the `ruff-lsp` language server. | ||
*/ | ||
export const RUFF_LSP_SERVER_SCRIPT_PATH = path.join( | ||
BUNDLED_PYTHON_SCRIPTS_DIR, | ||
"tool", | ||
`server.py`, | ||
); | ||
|
||
export const DEBUG_SERVER_SCRIPT_PATH = path.join( | ||
BUNDLED_PYTHON_SCRIPTS_DIR, | ||
"tool", | ||
`_debug_server.py`, | ||
); | ||
export const EXPERIMENTAL_SERVER_SCRIPT_PATH = path.join( | ||
|
||
/** | ||
* Path to the Python script that starts the native language server with an | ||
* appropriate `ruff` executable. | ||
* | ||
* This should only be used as a fallback if the user has not specified either | ||
* the `path` setting or is not using the bundled import strategy. | ||
*/ | ||
export const NATIVE_SERVER_SCRIPT_PATH = path.join( | ||
BUNDLED_PYTHON_SCRIPTS_DIR, | ||
"tool", | ||
"ruff_server.py", | ||
); | ||
export const RUFF_SERVER_CMD = "server"; | ||
|
||
/** | ||
* The subcommand for the `ruff` binary that starts the language server. | ||
*/ | ||
export const RUFF_SERVER_SUBCOMMAND = "server"; | ||
|
||
/** | ||
* Required arguments for the `ruff server` command. | ||
*/ | ||
export const RUFF_SERVER_REQUIRED_ARGS = ["--preview"]; |
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