-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1527 from rsteube/add-rust-analyzer
added rust-analyzer
- Loading branch information
Showing
11 changed files
with
230 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var analysisStatsCmd = &cobra.Command{ | ||
Use: "analysis-stats", | ||
Short: "Batch typecheck project and print summary statistics", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(analysisStatsCmd).Standalone() | ||
|
||
analysisStatsCmd.Flags().Bool("disable-build-scripts", false, "Don't run build scripts or load `OUT_DIR` values by running `cargo check` before analysis") | ||
analysisStatsCmd.Flags().Bool("disable-proc-macros", false, "Don't use expand proc macros") | ||
analysisStatsCmd.Flags().Bool("memory-usage", false, "Collect memory usage statistics") | ||
analysisStatsCmd.Flags().Bool("no-sysroot", false, "Don't load sysroot crates (`std`, `core` & friends)") | ||
analysisStatsCmd.Flags().StringP("only", "o", "", "Only analyze items matching this path") | ||
analysisStatsCmd.Flags().String("output", "", "") | ||
analysisStatsCmd.Flags().Bool("parallel", false, "Run type inference in parallel") | ||
analysisStatsCmd.Flags().Bool("randomize", false, "Randomize order in which crates, modules, and items are processed") | ||
analysisStatsCmd.Flags().Bool("skip-inference", false, "Only resolve names, don't run type inference") | ||
analysisStatsCmd.Flags().Bool("source-stats", false, "Print the total length of all source and macro files (whitespace is not counted)") | ||
analysisStatsCmd.Flags().Bool("with-deps", false, "Also analyze all dependencies") | ||
rootCmd.AddCommand(analysisStatsCmd) | ||
|
||
carapace.Gen(analysisStatsCmd).PositionalCompletion( | ||
carapace.ActionDirectories(), | ||
) | ||
} |
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,24 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var diagnosticsCmd = &cobra.Command{ | ||
Use: "diagnostics", | ||
Short: "", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(diagnosticsCmd).Standalone() | ||
|
||
diagnosticsCmd.Flags().Bool("disable-build-scripts", false, "Don't run build scripts or load `OUT_DIR` values by running `cargo check` before analysis.") | ||
diagnosticsCmd.Flags().Bool("disable-proc-macros", false, "Don't use expand proc macros.") | ||
rootCmd.AddCommand(diagnosticsCmd) | ||
|
||
carapace.Gen(diagnosticsCmd).PositionalCompletion( | ||
carapace.ActionDirectories(), | ||
) | ||
} |
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,19 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var highlightCmd = &cobra.Command{ | ||
Use: "highlight", | ||
Short: "Highlight stdin as html", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(highlightCmd).Standalone() | ||
|
||
highlightCmd.Flags().Bool("rainbow", false, "Enable rainbow highlighting of identifiers") | ||
rootCmd.AddCommand(highlightCmd) | ||
} |
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 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var lsifCmd = &cobra.Command{ | ||
Use: "lsif", | ||
Short: "", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(lsifCmd).Standalone() | ||
|
||
rootCmd.AddCommand(lsifCmd) | ||
|
||
carapace.Gen(lsifCmd).PositionalCompletion( | ||
carapace.ActionFiles(), | ||
) | ||
} |
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,19 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var parseCmd = &cobra.Command{ | ||
Use: "parse", | ||
Short: "Parse stdin", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(parseCmd).Standalone() | ||
|
||
parseCmd.Flags().Bool("no-dump", false, "Suppress printing") | ||
rootCmd.AddCommand(parseCmd) | ||
} |
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,18 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var procMacroCmd = &cobra.Command{ | ||
Use: "proc-macro", | ||
Short: "", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(procMacroCmd).Standalone() | ||
|
||
rootCmd.AddCommand(procMacroCmd) | ||
} |
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,33 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "rust-analyzer", | ||
Short: "LSP server for the Rust programming language", | ||
Long: "https://github.com/rust-lang/rust-analyzer", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func Execute() error { | ||
return rootCmd.Execute() | ||
} | ||
func init() { | ||
carapace.Gen(rootCmd).Standalone() | ||
|
||
rootCmd.Flags().BoolP("help", "h", false, "Print help") | ||
rootCmd.Flags().String("log-file", "", "Log to the specified file instead of stderr") | ||
rootCmd.Flags().Bool("no-log-buffering", false, "Flush log records to the file immediately") | ||
rootCmd.Flags().Bool("print-config-schema", false, "Dump a LSP config JSON schema") | ||
rootCmd.Flags().BoolP("quiet", "q", false, "Verbosity level") | ||
rootCmd.Flags().CountP("verbose", "v", "Verbosity level, can be repeated multiple times") | ||
rootCmd.Flags().Bool("version", false, "Print version") | ||
rootCmd.Flags().Bool("wait-dbg", false, "Wait until a debugger is attached to (requires debug build)") | ||
|
||
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{ | ||
"log-file": carapace.ActionFiles(), | ||
}) | ||
} |
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,19 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var searchCmd = &cobra.Command{ | ||
Use: "search", | ||
Short: "", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(searchCmd).Standalone() | ||
|
||
searchCmd.Flags().String("debug", "", "Prints debug information for any nodes with source exactly equal to snippet.") | ||
rootCmd.AddCommand(searchCmd) | ||
} |
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,18 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ssrCmd = &cobra.Command{ | ||
Use: "ssr", | ||
Short: "", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(ssrCmd).Standalone() | ||
|
||
rootCmd.AddCommand(ssrCmd) | ||
} |
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,18 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var symbolsCmd = &cobra.Command{ | ||
Use: "symbols", | ||
Short: "Parse stdin and print the list of symbols", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(symbolsCmd).Standalone() | ||
|
||
rootCmd.AddCommand(symbolsCmd) | ||
} |
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,7 @@ | ||
package main | ||
|
||
import "github.com/rsteube/carapace-bin/completers/rust-analyzer_completer/cmd" | ||
|
||
func main() { | ||
cmd.Execute() | ||
} |