بِسْمِ ٱللَّهِ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ
Environment Variables
Every environment variable refac reads, where it looks for language servers, and what it keeps on your machine.
Set these once in your shell profile and the commands will inshallah stay short.
Variables
| Variable | Meaning | Default |
|---|---|---|
REFAC_PROJECT_PATH | The default for --project-path | The current directory |
REFAC_GOPLS | Where gopls is installed | PATH, $GOBIN, $GOPATH/bin, ~/go/bin |
REFAC_RUST_ANALYZER | Where rust-analyzer is installed | PATH, then ~/.cargo/bin. rustup picks the toolchain from --project-path |
REFAC_PYTHON_SERVER | The basedpyright-langserver for Python rename | PATH, ~/.local/bin, and the project's .venv/bin and venv/bin |
REFAC_DART | The dart binary | PATH, $FLUTTER_ROOT/bin/cache/dart-sdk/bin |
REFAC_KOTLIN_SERVER | The folder of the Kotlin language server, the one with bin/intellij-server | None. refac never downloads it |
REFAC_LSP_TIMEOUT_SECS | How long a server may take to load or answer | 300 |
REFAC_KOTLIN_TIMEOUT_SECS | The same for the Kotlin Gradle import | 600 |
REFAC_KOTLIN_CACHE | Where the Kotlin server keeps its index between calls: a directory, or off | ~/.cache/refac |
REFAC_KOTLIN_MIRROR_VERSION | The Kotlin version of the plain-JVM copy used for a Multiplatform build, when the project does not state one in a place refac reads | Read from the project |
REFAC_KOTLIN_BATCH_ONLY | 0 lets a single Kotlin move or rename through. 1, empty, or unset refuses it. Anything else is an error | Refuse |
REFAC_KOTLIN_GRADLE_IDLE_SECS | Keep the Kotlin project's Gradle daemon up that many seconds after a command, from 1 to 3600 | Off. The daemon stops 10 s after the import |
REFAC_TYPESCRIPT_MAX_RSS_MB | The RAM limit of the TypeScript helper, in MiB | 4096 |
REFAC_DRY_RUN_COPY_MAX_MB | The size limit of the throw-away copy that dry runs of Python (Rope), Kotlin, and move-module --check use | 500 |
REFAC_LSP_TRACE | 1 prints every message exchanged with a server | Off |
RUST_LOG | debug shows more of refac's own log on stderr | Off |
A server that does not answer is an error after the timeout, and never a hang.
How a server is found
- The environment variable of the language. If it is set, it is the only place looked at, so a wrong value is reported as wrong instead of silently replaced.
- Otherwise the
PATH. - Otherwise the folders that installers use, which are the language's own toolchain folders.
A place counts only when the program there runs. A stand-in that exists but fails, such as rustup's rust-analyzer without the component, is reported as broken.
When a server is missing, the failing command lists every place it looked and stops. Then run refac doctor <language> for the install steps and a start check, install the tool, and run the original command again.
What refac keeps on your machine
Only the Kotlin server's index: 110 to 160 MB in ~/.cache/refac, deleted when it passes 2 GB. It is why the next Kotlin call is ready in 9 to 16 seconds instead of 32 to 38. REFAC_KOTLIN_CACHE=off keeps nothing, and a directory moves it.
The Kotlin Gradle daemon is told to stop itself 10 seconds after the import, instead of the three hours that Gradle defaults to. REFAC_KOTLIN_GRADLE_IDLE_SECS keeps it longer when you ask. Nothing else stays: every other server stops when its command ends.