Add sorbet vscode configuration

This commit is contained in:
Rylan Polster 2024-08-02 15:53:18 -04:00
parent b26bf95288
commit 6badcd929c
No known key found for this signature in database
2 changed files with 29 additions and 0 deletions

15
.vscode/settings.json vendored
View File

@ -18,6 +18,21 @@
"editor.formatOnType": true, "editor.formatOnType": true,
"editor.semanticHighlighting.enabled": true, "editor.semanticHighlighting.enabled": true,
}, },
"sorbet.enabled": true,
"sorbet.lspConfigs": [
{
"id": "default",
"name": "Brew Typecheck",
"description": "Default configuration",
"cwd": "${workspaceFolder}",
"command": [
"./bin/brew",
"typecheck",
"--lsp",
]
}
],
"sorbet.selectedLspConfigId": "default",
"shellcheck.customArgs": [ "shellcheck.customArgs": [
"--shell=bash", "--shell=bash",
"--enable=all", "--enable=all",

View File

@ -24,6 +24,8 @@ module Homebrew
switch "--suggest-typed", switch "--suggest-typed",
depends_on: "--update", depends_on: "--update",
description: "Try upgrading `typed` sigils." description: "Try upgrading `typed` sigils."
switch "--lsp",
description: "Start the Sorbet LSP server."
flag "--dir=", flag "--dir=",
description: "Typecheck all files in a specific directory." description: "Typecheck all files in a specific directory."
flag "--file=", flag "--file=",
@ -33,6 +35,9 @@ module Homebrew
"in their paths (relative to the input path passed to Sorbet)." "in their paths (relative to the input path passed to Sorbet)."
conflicts "--dir", "--file" conflicts "--dir", "--file"
conflicts "--lsp", "--update"
conflicts "--lsp", "--update-all"
conflicts "--lsp", "--fix"
named_args :none named_args :none
end end
@ -80,6 +85,15 @@ module Homebrew
srb_exec << "--autocorrect" srb_exec << "--autocorrect"
end end
if args.lsp?
srb_exec << "--lsp"
if (watchman = which("watchman", ORIGINAL_PATHS))
srb_exec << "--watchman-path" << watchman
else
srb_exec << "--disable-watchman" unless which("watchman", ORIGINAL_PATHS)
end
end
srb_exec += ["--ignore", args.ignore] if args.ignore.present? srb_exec += ["--ignore", args.ignore] if args.ignore.present?
if args.file.present? || args.dir.present? if args.file.present? || args.dir.present?
cd("sorbet") do cd("sorbet") do