### Install GHCup and tools on Linux Source: https://github.com/scip-code/scip/blob/main/bindings/haskell/README.md Instructions to install GHCup, GHC, and Cabal on a Linux environment. ```sh # Linux GHCUPVERSION=0.1.17.4 curl --proto '=https' --tlsv1.2 -sSf https://downloads.haskell.org/~ghcup/$GHCUPVERSION/x86_64-linux-ghcup-$GHCUPVERSION > /usr/bin/ghcup && \ chmod +x /usr/bin/ghcup ghcup install ghc 8.10.7 --set ghcup install cabal 3.6.0.0 --set ``` -------------------------------- ### Reprolang Example Source: https://github.com/scip-code/scip/blob/main/reprolang/README.md An example demonstrating the definition and referencing of global and local symbols, forward references, cross-repo references, and relationships in Reprolang. ```repro # Define a global symbol and reference it definition hello(). reference hello(). # Local symbol (file-scoped) definition local myHelper reference local myHelper # Forward reference (reference before definition) reference forward_definition abc# definition abc# # Cross-repo reference reference global other-repo animal# # Relationships definition dog# implements animal# definition Cat# type_defines animal# ``` -------------------------------- ### Install GHCup and tools on macOS Source: https://github.com/scip-code/scip/blob/main/bindings/haskell/README.md Instructions to install GHCup, GHC, and Cabal on a macOS environment. ```sh # macOS GHCUPVERSION=0.1.17.4 curl --proto '=https' --tlsv1.2 -sSf https://downloads.haskell.org/~ghcup/$GHCUPVERSION/x86_64-apple-darwin-ghcup-$GHCUPVERSION > /usr/local/bin/ghcup && \ chmod +x /usr/local/bin/ghcup ghcup install ghc 8.10.7 --set ghcup install cabal 3.6.0.0 --set ``` -------------------------------- ### Install proto-lens-protoc Source: https://github.com/scip-code/scip/blob/main/bindings/haskell/README.md Command to install the Haskell generator for protobuf from proto-lens packages. ```sh cabal install proto-lens-protoc ``` -------------------------------- ### Occurrence Example Source: https://github.com/scip-code/scip/blob/main/docs/scip.md Example of how to find occurrences of a symbol. ```javascript const b = a.b(41).f(42).g(43) ``` -------------------------------- ### Test Case Types and Data Source: https://github.com/scip-code/scip/blob/main/docs/test_file_format.md Examples demonstrating 'definition' and 'reference' test cases, showing how to specify symbols for ranges. ```javascript function someFunction() { // ^ definition scip-typescript npm test_package 1.0.0 lib/`test.js`/someFunction(). someOtherFunction() // <- reference scip-typescript npm test_package 1.0.0 lib/`test.js`/someOtherFunction(). } ``` -------------------------------- ### Reference Occurrence Example Source: https://github.com/scip-code/scip/blob/main/docs/scip.md Demonstrates 'range' for a reference occurrence in JavaScript. ```javascript const a = a.b ^ range ``` -------------------------------- ### Range and Enclosing Range Example Source: https://github.com/scip-code/scip/blob/main/docs/scip.md Illustrates the 'range' and 'enclosing_range' fields in a JavaScript context. ```javascript const n = 3 ^ range ^^^^^^^^^^^ enclosing_range /** Parses the string into something */ ^ enclosing_range start --------------------------------------| function parse(input string): string { | ^^^^^ range | return input.slice(n) | } ^ enclosing_range end <---------------------------------------| ``` -------------------------------- ### TypeScript Example for Relationship is_reference Source: https://github.com/scip-code/scip/blob/main/docs/scip.md Illustrates how `is_reference` and `is_implementation` work in TypeScript for symbol relationships. ```typescript interface Animal { ^^^^^^ definition Animal# sound(): string ^^^^^ definition Animal#sound() } class Dog implements Animal { ^^^ definition Dog#, relationships = [{symbol: "Animal#", is_implementation: true}] public sound(): string { return "woof" } ^^^^^ definition Dog#sound(), references_symbols = Animal#sound(), relationships = [{symbol: "Animal#sound()", is_implementation:true, is_reference: true}] } const animal: Animal = new Dog() ^^^^^^ reference Animal# console.log(animal.sound()) ^^^^^ reference Animal#sound() ``` -------------------------------- ### Range Selection Comments Source: https://github.com/scip-code/scip/blob/main/docs/test_file_format.md Examples of the three supported range selection comment formats: `^^^` for length enforcement, `^` for any point in the occurrence, and `<-` for the start of the occurrence. ```javascript function someFunction() { // ^ ... // ^^^^^^^^^^^^ ... // <- ... } ``` -------------------------------- ### Diagnostic Message Spanning Multiple Lines Source: https://github.com/scip-code/scip/blob/main/docs/test_file_format.md Example showing how to specify a diagnostic message that spans multiple lines using the '>' prefix. ```javascript function someFn() { let someVar = '' // ^ diagnostic Warning // > someVar is unused. // > remove it or use it. } ``` -------------------------------- ### SCIP CLI Global Options and Commands Source: https://github.com/scip-code/scip/blob/main/docs/CLI.md Overview of the SCIP CLI, its usage, version, and available commands. ```bash NAME: scip - SCIP Code Intelligence Protocol CLI USAGE: scip [global options] [command [command options]] VERSION: v0.7.1 DESCRIPTION: For more details, see the project README at: https://github.com/scip-code/scip COMMANDS: lint Flag potential issues with a SCIP index print Print a SCIP index for debugging snapshot Generate snapshot files for golden testing stats Output useful statistics about a SCIP index test Validate a SCIP index against test files expt-convert [EXPERIMENTAL] Convert a SCIP index to a SQLite database help, h Shows a list of commands or help for one command GLOBAL OPTIONS: --help, -h show help --version, -v print the version ``` -------------------------------- ### scip expt-convert command help Source: https://github.com/scip-code/scip/blob/main/docs/CLI.md Help output for the experimental `scip expt-convert` command, detailing its purpose, usage, and options for converting SCIP indexes to SQLite databases. ```bash NAME: scip expt-convert - [EXPERIMENTAL] Convert a SCIP index to a SQLite database USAGE: scip expt-convert [options] DESCRIPTION: Converts a SCIP index to a SQLite database. For inspecting the data, use the SQLite CLI. For inspecting the schema, use .schema. Occurrences are stored opaquely as a blob to prevent the DB size from growing very quickly. OPTIONS: --output string Path to output SQLite database file (default: "index.db") --cpu-profile string Path to output prof file --help, -h show help ``` -------------------------------- ### Generate SCIP proto files Source: https://github.com/scip-code/scip/blob/main/bindings/haskell/README.md Command to generate Haskell source files from scip.proto using protoc. ```sh # working directory: bindings/haskell protoc --plugin=protoc-gen-haskell=`which proto-lens-protoc` --haskell_out=src --proto_path=../.. scip.proto ``` -------------------------------- ### Running Reprolang Tests Source: https://github.com/scip-code/scip/blob/main/reprolang/README.md Commands to run tests for the project and update snapshots. ```bash go test ./... ``` ```bash go test ./repro -update-snapshots ``` -------------------------------- ### Build the Haskell library Source: https://github.com/scip-code/scip/blob/main/bindings/haskell/README.md Command to build the Haskell library using Cabal. ```sh # working directory: bindings/haskell cabal build ``` -------------------------------- ### Decode SCIP index with protoc Source: https://github.com/scip-code/scip/blob/main/docs/Development.md Command to inspect the default Protobuf output of a SCIP index using 'protoc'. ```bash protoc --decode=scip.Index -I /path/to/scip scip.proto < index.scip ``` -------------------------------- ### Compile a binary locally Source: https://github.com/scip-code/scip/blob/main/README.md Instructions on how to compile a local binary for the scip CLI. ```sh git clone https://github.com/scip-code/scip.git --depth=1 cd scip go build ./cmd/scip ``` -------------------------------- ### scip lint command Source: https://github.com/scip-code/scip/blob/main/docs/CLI.md Details on how to use the 'scip lint' command to flag potential issues with a SCIP index. ```bash NAME: scip lint - Flag potential issues with a SCIP index USAGE: scip lint [options] DESCRIPTION: Example usage: scip lint /path/to/index.scip You may want to filter the output using `grep -v ` to narrow down on certain classes of errors. OPTIONS: --help, -h show help ``` -------------------------------- ### Print SCIP index Source: https://github.com/scip-code/scip/blob/main/docs/Development.md Command to inspect Protobuf output of a SCIP index using 'scip print'. ```bash scip print /path/to/index.scip ``` -------------------------------- ### scip snapshot command Source: https://github.com/scip-code/scip/blob/main/docs/CLI.md Usage of the 'scip snapshot' command to generate snapshot files for golden testing, with options for input, output, and project root. ```bash NAME: scip snapshot - Generate snapshot files for golden testing USAGE: scip snapshot [options] DESCRIPTION: The snapshot subcommand generates snapshot files which can be use for inspecting the output of an index in a visual way. Occurrences are marked with caret signs (^) and symbol information. For testing a SCIP indexer, you can either use this subcommand along with 'git diff' or equivalent, or you can use the dedicated 'test' subcommand for more targeted checks. OPTIONS: --from string Path to SCIP index file (default: "index.scip") --to string Path to output directory for snapshot files (default: "scip-snapshot") --project-root string Override project root in the SCIP file. This can be helpful when the SCIP index was created on another computer --strict If true, fail fast on errors --comment-syntax string Comment syntax to use for snapshot files (default: "//") --help, -h show help ``` -------------------------------- ### Regenerating the Parser Source: https://github.com/scip-code/scip/blob/main/reprolang/README.md Command to regenerate the tree-sitter parser, requiring tree-sitter and prettier in the PATH. ```bash ./generate-tree-sitter-parser.sh ``` -------------------------------- ### Regenerate definitions from schema Source: https://github.com/scip-code/scip/blob/main/docs/Development.md Command to regenerate SCIP definitions after changing the schema in scip.proto. ```bash nix run .#proto-generate ``` -------------------------------- ### SCIP Symbol Syntax Source: https://github.com/scip-code/scip/blob/main/docs/scip.md Defines the grammar for SCIP symbols, including their components like scheme, package, and descriptors. ```protobuf syntax = "proto3"; package scip.protocol; // ()? stands for zero or one occurrence of message Symbol { // scheme ' ' ' ' ()+ | 'local ' string symbol = 1; } message Package { // ' ' ' ' string manager = 1; string name = 2; string version = 3; } // ::= any UTF-8, escape spaces with double space. Must not be empty nor start with 'local' // ::= any UTF-8, escape spaces with double space. Use the placeholder '.' to indicate an empty value // ::= same as above // ::= same as above // ::= | | | | | | | // ::= '/' // ::= '#' // ::= '.' // ::= ':' // ::= '!' // ::= '(' ()? ').' // ::= '[' ']' // ::= '(' ')' // ::= // ::= // ::= | // ::= ()+ // ::= '_' | '+' | '-' | '$' | ASCII letter or digit // ::= '`' ()+ '`', must contain at least one non- // ::= any UTF-8, escape backticks with double backtick. // ::= ``` -------------------------------- ### Regenerate Repro parser Source: https://github.com/scip-code/scip/blob/main/docs/Development.md Commands to regenerate the parser for Repro after editing its grammar. ```bash cd reprolang ./generate-tree-sitter-parser.sh ``` -------------------------------- ### Symbol String Representation Syntax Source: https://github.com/scip-code/scip/blob/main/docs/scip.md The standardized string representation syntax for SCIP Symbols. ```plaintext # ()+ stands for one or more repetitions of ``` -------------------------------- ### Lint SCIP index Source: https://github.com/scip-code/scip/blob/main/docs/Development.md Command to perform well-formedness checks on a SCIP index. ```bash scip lint /path/to/index.scip ``` -------------------------------- ### scip stats command Source: https://github.com/scip-code/scip/blob/main/docs/CLI.md Details on the 'scip stats' command for outputting statistics about a SCIP index, including options for input file and project root. ```bash NAME: scip stats - Output useful statistics about a SCIP index USAGE: scip stats [options] OPTIONS: --from string Path to SCIP index file (default: "index.scip") --project-root string Override project root in the SCIP file. This can be helpful when the SCIP index was created on another computer --help, -h show help ``` -------------------------------- ### scip test command Source: https://github.com/scip-code/scip/blob/main/docs/CLI.md Explanation of the 'scip test' command for validating SCIP indexes against test files, including options for filtering and document checking. ```bash NAME: scip test - Validate a SCIP index against test files USAGE: scip test [options] DESCRIPTION: Validates whether the SCIP data present in an index matches that specified in human-readable test files, using syntax similar to the 'snapshot' subcommand. Test file syntax reference: https://github.com/scip-code/scip/blob/v0.7.1 /docs/test_file_format.md The test files are located based on the relative_path field in the SCIP document, interpreted relative to the the directory the CLI is invoked in. If you want to instead check all the data in a SCIP index, use the 'snapshot' subcommand. OPTIONS: --from string Path to SCIP index file (default: "index.scip") --comment-syntax string Comment syntax to use for snapshot files (default: "//") --filter string, -f string [ --filter string, -f string ] Explicit list of test files to check. Can be specified multiple times. If not specified, all files are tested. --check-documents Whether or not to validate whether every file in the test directory has a correlating document in the SCIP index. --help, -h show help ``` -------------------------------- ### scip print command Source: https://github.com/scip-code/scip/blob/main/docs/CLI.md Information on using the 'scip print' command for debugging SCIP indexes, including JSON output option. ```bash NAME: scip print - Print a SCIP index for debugging USAGE: scip print [options] DESCRIPTION: WARNING: The TTY output may change over time. Do not rely on non-JSON output in scripts OPTIONS: --json Output in JSON format --color Enable color output for TTY (no effect for JSON) (default: true) --help, -h show help ``` -------------------------------- ### Enclosing Range for Decorated Functions Source: https://github.com/scip-code/scip/blob/main/docs/scip.md Shows how 'enclosing_range' applies to decorated functions in Python. ```python @cache ^ enclosing_range start---------------------| def factorial(n): | return n * factorial(n-1) if n else 1 | < enclosing_range end-----------------------| ``` -------------------------------- ### Regenerate CLI snapshots Source: https://github.com/scip-code/scip/blob/main/docs/Development.md Command to regenerate snapshots after making changes to the SCIP CLI. ```bash go test ./cmd/scip -update-snapshots ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.