|
nixd
|
Namespaces | |
| namespace | rpcMethod |
| namespace | rpc |
| namespace | util |
| namespace | idioms |
Classes | |
| struct | Configuration |
| class | Controller |
| class | EvalClient |
| class | OwnedEvalClient |
| class | NixTU |
| Holds analyzed information about a document. More... | |
| class | AttrSetClient |
| class | AttrSetClientProc |
| class | AttrSetProvider |
| Main RPC class for attrset provider. More... | |
| class | EvalProvider |
| struct | PackageDescription |
| struct | ValueMeta |
| General metadata of all nix::Values. More... | |
| struct | ValueDescription |
| Using nix's ":doc" method to retrieve value's additional information. More... | |
| struct | AttrPathInfoResponse |
| struct | AttrPathCompleteParams |
| struct | OptionType |
| struct | OptionDescription |
| struct | OptionField |
| class | LLVMErrorException |
| class | JSONParseException |
| class | JSONSchemaException |
| struct | StreamProc |
| struct | CannotFindVarException |
Typedefs | |
| using | EvalExprParams = std::string |
| using | EvalExprResponse = std::optional<std::string> |
| using | Selector = std::vector<std::string> |
| A list of strings that "select"s into a attribute set. | |
| using | PackageInfoParams = Selector |
| using | OptionInfoParams = Selector |
| using | AttrPathInfoParams = Selector |
| using | AttrPathCompleteResponse = std::vector<std::string> |
| using | OptionInfoResponse = OptionDescription |
| using | OptionCompleteResponse = std::vector<OptionField> |
Enumerations | |
| enum class | FindAttrPathResult { OK , Inherit , NotAttrPath , WithDynamic } |
Functions | |
| nixd::Configuration | parseCLIConfig () |
| Parse the CLI flag and initialize the config nixd::DefaultConfig. | |
| bool | fromJSON (const llvm::json::Value &Params, Configuration::Diagnostic &R, llvm::json::Path P) |
| bool | fromJSON (const llvm::json::Value &Params, Configuration::Formatting &R, llvm::json::Path P) |
| bool | fromJSON (const llvm::json::Value &Params, Configuration::OptionProvider &R, llvm::json::Path P) |
| bool | fromJSON (const llvm::json::Value &Params, Configuration::NixpkgsProvider &R, llvm::json::Path P) |
| bool | fromJSON (const llvm::json::Value &Params, Configuration &R, llvm::json::Path P) |
| void | startAttrSetEval (const std::string &Name, std::unique_ptr< AttrSetClientProc > &Worker) |
| void | startNixpkgs (std::unique_ptr< AttrSetClientProc > &NixpkgsEval) |
| void | startOption (const std::string &Name, std::unique_ptr< AttrSetClientProc > &Worker) |
| llvm::json::Value | toJSON (const PackageDescription &Params) |
| bool | fromJSON (const llvm::json::Value &Params, PackageDescription &R, llvm::json::Path P) |
| llvm::json::Value | toJSON (const ValueMeta &Params) |
| bool | fromJSON (const llvm::json::Value &Params, ValueMeta &R, llvm::json::Path P) |
| llvm::json::Value | toJSON (const ValueDescription &Params) |
| bool | fromJSON (const llvm::json::Value &Params, ValueDescription &R, llvm::json::Path P) |
| llvm::json::Value | toJSON (const AttrPathInfoResponse &Params) |
| bool | fromJSON (const llvm::json::Value &Params, AttrPathInfoResponse &R, llvm::json::Path P) |
| llvm::json::Value | toJSON (const AttrPathCompleteParams &Params) |
| bool | fromJSON (const llvm::json::Value &Params, AttrPathCompleteParams &R, llvm::json::Path P) |
| llvm::json::Value | toJSON (const OptionType &Params) |
| bool | fromJSON (const llvm::json::Value &Params, OptionType &R, llvm::json::Path P) |
| llvm::json::Value | toJSON (const OptionDescription &Params) |
| bool | fromJSON (const llvm::json::Value &Params, OptionDescription &R, llvm::json::Path P) |
| llvm::json::Value | toJSON (const OptionField &Params) |
| bool | fromJSON (const llvm::json::Value &Params, OptionField &R, llvm::json::Path P) |
| int | forkPiped (int &In, int &Out, int &Err) |
| fork this process and create some pipes connected to the new process. | |
| llvm::json::Value | parse (llvm::StringRef JSON) |
| template<class T> | |
| T | fromJSON (const llvm::json::Value &V) |
| const nixf::EnvNode * | upEnv (const nixf::Node &Desc, const nixf::VariableLookupAnalysis &VLA, const nixf::ParentMapAnalysis &PM) |
| Search up until there are some node associated with "EnvNode". | |
| bool | havePackageScope (const nixf::Node &N, const nixf::VariableLookupAnalysis &VLA, const nixf::ParentMapAnalysis &PM) |
| Determine whether or not some node has enclosed "with pkgs; [ ]". | |
| std::pair< std::vector< std::string >, std::string > | getScopeAndPrefix (const nixf::Node &N, const nixf::ParentMapAnalysis &PM) |
| get variable scope, and it's prefix name. | |
| FindAttrPathResult | findAttrPath (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, std::vector< std::string > &Path) |
| Heuristically find attrpath suitable for "attrpath" completion. | |
| FindAttrPathResult | findAttrPathForOptions (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, std::vector< std::string > &Path) |
| Heuristically find attrpath suitable for "attrpath" completion. Strips "config." from the start to support config sections in NixOS modules. | |
| void | addToFormalsAction (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, const nixf::VariableLookupAnalysis &VLA, const std::string &FileURI, llvm::StringRef Src, std::vector< lspserver::CodeAction > &Actions) |
| Add code action to add undefined variable to lambda formals. | |
| void | addAttrNameActions (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, const std::string &FileURI, llvm::StringRef Src, std::vector< lspserver::CodeAction > &Actions) |
| Add refactoring code actions for attribute names (quote/unquote). | |
| void | addConvertToInheritAction (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, const std::string &FileURI, llvm::StringRef Src, std::vector< lspserver::CodeAction > &Actions) |
| Add code action to convert binding to inherit syntax. | |
| void | addExtractToFileAction (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, const nixf::VariableLookupAnalysis &VLA, const std::string &FileURI, llvm::StringRef Src, std::vector< lspserver::CodeAction > &Actions) |
| Add extract-to-file action for selected expressions. | |
| void | addFlattenAttrsAction (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, const std::string &FileURI, llvm::StringRef Src, std::vector< lspserver::CodeAction > &Actions) |
| Add flatten action for nested attribute sets. | |
| void | addInheritToBindingAction (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, const std::string &FileURI, llvm::StringRef Src, std::vector< lspserver::CodeAction > &Actions) |
| Add code action to convert inherit to explicit binding. | |
| void | addJsonToNixAction (llvm::StringRef Src, const lspserver::Range &Range, const std::string &FileURI, std::vector< lspserver::CodeAction > &Actions) |
| Add JSON to Nix conversion action for selected JSON text. | |
| void | addNoogleDocAction (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, std::vector< lspserver::CodeAction > &Actions) |
| Add a code action to open noogle.dev documentation for lib.* functions. | |
| void | addPackAttrsAction (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, const std::string &FileURI, llvm::StringRef Src, std::vector< lspserver::CodeAction > &Actions) |
| Add pack action for dotted attribute paths. | |
| void | addRewriteStringAction (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, const std::string &FileURI, llvm::StringRef Src, std::vector< lspserver::CodeAction > &Actions) |
| Add rewrite action for string literal syntax conversion. | |
| lspserver::CodeAction | createSingleEditAction (const std::string &Title, llvm::StringLiteral Kind, const std::string &FileURI, const lspserver::Range &EditRange, std::string NewText) |
| Create a CodeAction with a single text edit. | |
| bool | isValidNixIdentifier (const std::string &S) |
| Check if a string is a valid Nix identifier that can be unquoted. | |
| std::string | escapeNixString (llvm::StringRef S) |
| Escape special characters for Nix double-quoted string literals. | |
| std::string | quoteNixAttrKey (const std::string &Key) |
| Quote and escape a Nix attribute key if necessary. | |
| void | addWithToLetAction (const nixf::Node &N, const nixf::ParentMapAnalysis &PM, const nixf::VariableLookupAnalysis &VLA, const std::string &FileURI, llvm::StringRef Src, std::vector< lspserver::CodeAction > &Actions) |
| Add code action to convert with expression to let/inherit. | |
| lspserver::Position | toLSPPosition (llvm::StringRef Code, const nixf::LexerCursor &P) |
| nixf::Position | toNixfPosition (const lspserver::Position &P) |
| nixf::PositionRange | toNixfRange (const lspserver::Range &P) |
| lspserver::Range | toLSPRange (llvm::StringRef Code, const nixf::LexerCursorRange &R) |
| int | getLSPSeverity (nixf::Diagnostic::DiagnosticKind Kind) |
| llvm::SmallVector< lspserver::DiagnosticTag, 1 > | toLSPTags (const std::vector< nixf::DiagnosticTag > &Tags) |
| const nixf::Definition & | findDefinition (const nixf::Node &N, const nixf::ParentMapAnalysis &PMA, const nixf::VariableLookupAnalysis &VLA) |
| Heuristically find definition on some node. | |
| std::optional< std::string > | resolveExprPath (const std::string &BasePath, const std::string &ExprPath) |
| Resolve a Nix expression path to a real filesystem path. | |
Variables | |
| llvm::cl::OptionCategory | NixdCategory |
| llvm::cl::opt< bool > | LitTest |
| Indicating that we are in lit-test mode. | |
| constexpr size_t | MaxJsonDepth = 100 |
| Maximum recursion depth for JSON to Nix conversion. | |
| constexpr size_t | MaxJsonWidth = 10000 |
| Maximum array/object width for JSON to Nix conversion. | |
| using nixd::AttrPathCompleteResponse = std::vector<std::string> |
| using nixd::AttrPathInfoParams = Selector |
| using nixd::EvalExprParams = std::string |
| using nixd::EvalExprResponse = std::optional<std::string> |
| using nixd::OptionCompleteResponse = std::vector<OptionField> |
| using nixd::OptionInfoParams = Selector |
| using nixd::PackageInfoParams = Selector |
| using nixd::Selector = std::vector<std::string> |
|
strong |
| void nixd::addAttrNameActions | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| const std::string & | FileURI, | ||
| llvm::StringRef | Src, | ||
| std::vector< lspserver::CodeAction > & | Actions ) |
Add refactoring code actions for attribute names (quote/unquote).
Definition at line 13 of file AttrName.cpp.
References nixf::AttrName::ANK_ID, nixf::AttrName::ANK_String, createSingleEditAction(), isValidNixIdentifier(), lspserver::CodeAction::REFACTOR_REWRITE_KIND, toLSPRange(), and nixf::ParentMapAnalysis::upTo().
| void nixd::addConvertToInheritAction | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| const std::string & | FileURI, | ||
| llvm::StringRef | Src, | ||
| std::vector< lspserver::CodeAction > & | Actions ) |
Add code action to convert binding to inherit syntax.
This action is offered when the cursor is on a binding that matches one of these patterns:
The action is NOT offered when:
Definition at line 15 of file ConvertToInherit.cpp.
References createSingleEditAction(), nixf::Node::lCur(), nixf::AttrPath::names(), nixf::LexerCursor::offset(), nixf::Binding::path(), nixf::ExprSelect::path(), quoteNixAttrKey(), nixf::Node::rCur(), lspserver::CodeAction::REFACTOR_REWRITE_KIND, toLSPRange(), nixf::ParentMapAnalysis::upTo(), and lspserver::Value.
| void nixd::addExtractToFileAction | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| const nixf::VariableLookupAnalysis & | VLA, | ||
| const std::string & | FileURI, | ||
| llvm::StringRef | Src, | ||
| std::vector< lspserver::CodeAction > & | Actions ) |
Add extract-to-file action for selected expressions.
This action is offered when the cursor is on any valid Nix expression. It creates a new file with the expression content and replaces the original expression with an import statement. If the expression contains free variables (variables used but not defined within the expression), they are wrapped in a lambda in the new file.
Example transformation: Original: { buildInputs = [ pkgs.foo pkgs.bar ]; } New file (buildInputs.nix): { pkgs }: [ pkgs.foo pkgs.bar ] Replaced: { buildInputs = import ./buildInputs.nix { inherit pkgs; }; }
Definition at line 322 of file ExtractToFile.cpp.
References lspserver::URIForFile::canonicalize(), lspserver::WorkspaceEdit::documentChanges, lspserver::CodeAction::edit, lspserver::TextDocumentEdit::edits, lspserver::CodeAction::kind, lspserver::CreateFile::options, nixf::Node::range(), lspserver::CodeAction::REFACTOR_KIND, nixf::Node::src(), lspserver::TextDocumentEdit::textDocument, lspserver::CodeAction::title, toLSPRange(), lspserver::CreateFile::uri, lspserver::TextDocumentIdentifier::uri, and lspserver::VersionedTextDocumentIdentifier::version.
| void nixd::addFlattenAttrsAction | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| const std::string & | FileURI, | ||
| llvm::StringRef | Src, | ||
| std::vector< lspserver::CodeAction > & | Actions ) |
Add flatten action for nested attribute sets.
This action is offered when the cursor is on a binding whose value is a non-recursive attribute set. It flattens all nested bindings into dotted paths.
Definition at line 44 of file FlattenAttrs.cpp.
References nixf::Binds::bindings(), createSingleEditAction(), nixf::Binding::path(), lspserver::CodeAction::REFACTOR_REWRITE_KIND, nixf::Node::src(), toLSPRange(), and nixf::ParentMapAnalysis::upTo().
| void nixd::addInheritToBindingAction | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| const std::string & | FileURI, | ||
| llvm::StringRef | Src, | ||
| std::vector< lspserver::CodeAction > & | Actions ) |
Add code action to convert inherit to explicit binding.
This action converts inherit statements to explicit bindings:
The action is only offered when the inherit has exactly one name.
Definition at line 15 of file InheritToBinding.cpp.
References createSingleEditAction(), Inherit, nixf::Inherit::names(), lspserver::CodeAction::REFACTOR_REWRITE_KIND, toLSPRange(), and nixf::ParentMapAnalysis::upTo().
| void nixd::addJsonToNixAction | ( | llvm::StringRef | Src, |
| const lspserver::Range & | Range, | ||
| const std::string & | FileURI, | ||
| std::vector< lspserver::CodeAction > & | Actions ) |
Add JSON to Nix conversion action for selected JSON text.
This is a selection-based action that works on arbitrary text, not AST nodes. It parses the selected text as JSON and converts it to Nix syntax.
Definition at line 97 of file JsonToNix.cpp.
References createSingleEditAction(), lspserver::Range::end, lspserver::positionToOffset(), lspserver::CodeAction::REFACTOR_REWRITE_KIND, and lspserver::Range::start.
| void nixd::addNoogleDocAction | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| std::vector< lspserver::CodeAction > & | Actions ) |
Add a code action to open noogle.dev documentation for lib.* functions.
This action is offered when the cursor is on an ExprSelect with:
Examples that trigger:
Examples that do NOT trigger:
Definition at line 30 of file NoogleDoc.cpp.
References lspserver::CodeAction::REFACTOR_KIND, and nixf::ParentMapAnalysis::upTo().
| void nixd::addPackAttrsAction | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| const std::string & | FileURI, | ||
| llvm::StringRef | Src, | ||
| std::vector< lspserver::CodeAction > & | Actions ) |
Add pack action for dotted attribute paths.
This action is offered when the cursor is on a binding with a dotted path (e.g., foo.bar = 1). It offers three variants:
Definition at line 187 of file PackAttrs.cpp.
References createSingleEditAction(), nixf::ExprAttrs::isRecursive(), nixf::Node::kind(), nixf::AttrPath::names(), nixf::LexerCursor::offset(), nixf::Binding::path(), nixf::ParentMapAnalysis::query(), quoteNixAttrKey(), nixf::Node::range(), nixf::LexerCursorRange::rCur(), lspserver::CodeAction::REFACTOR_REWRITE_KIND, nixf::ExprAttrs::sema(), nixf::Node::src(), nixf::SemaAttrs::staticAttrs(), toLSPRange(), nixf::ParentMapAnalysis::upTo(), nixf::Attribute::value(), and nixf::Binding::value().
| void nixd::addRewriteStringAction | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| const std::string & | FileURI, | ||
| llvm::StringRef | Src, | ||
| std::vector< lspserver::CodeAction > & | Actions ) |
Add rewrite action for string literal syntax conversion.
This action is offered when the cursor is on a string literal. It converts between double-quoted strings ("...") and indented strings (''...''), properly handling escape sequence differences.
Definition at line 106 of file RewriteString.cpp.
References createSingleEditAction(), lspserver::CodeAction::REFACTOR_REWRITE_KIND, toLSPRange(), and nixf::ParentMapAnalysis::upTo().
| void nixd::addToFormalsAction | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| const nixf::VariableLookupAnalysis & | VLA, | ||
| const std::string & | FileURI, | ||
| llvm::StringRef | Src, | ||
| std::vector< lspserver::CodeAction > & | Actions ) |
Add code action to add undefined variable to lambda formals.
This action is offered when:
The action is NOT offered when:
Transformation example: {x}: y -> {x, y}: y
Definition at line 20 of file AddToFormals.cpp.
References nixf::LexerCursor::column(), nixf::Formals::dedup(), lspserver::CodeAction::edit, nixf::Formal::isEllipsis(), lspserver::CodeAction::isPreferred, lspserver::CodeAction::kind, nixf::Node::lCur(), nixf::LexerCursor::line(), nixf::Formals::members(), nixf::Node::name(), nixf::LexerCursor::offset(), nixf::VariableLookupAnalysis::query(), lspserver::CodeAction::QUICKFIX_KIND, quoteNixAttrKey(), nixf::Node::rCur(), lspserver::CodeAction::title, toLSPPosition(), nixf::VariableLookupAnalysis::Undefined, nixf::LexerCursor::unsafeCreate(), and nixf::ParentMapAnalysis::upTo().
| void nixd::addWithToLetAction | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| const nixf::VariableLookupAnalysis & | VLA, | ||
| const std::string & | FileURI, | ||
| llvm::StringRef | Src, | ||
| std::vector< lspserver::CodeAction > & | Actions ) |
Add code action to convert with expression to let/inherit.
This action is offered when the cursor is on the with keyword. It transforms with source; body into let inherit (source) vars; in body where vars are all variables used from the with scope.
The action is NOT offered when:
Definition at line 133 of file WithToLet.cpp.
References createSingleEditAction(), nixf::Node::range(), lspserver::CodeAction::REFACTOR_REWRITE_KIND, toLSPRange(), and nixf::ParentMapAnalysis::upTo().
| lspserver::CodeAction nixd::createSingleEditAction | ( | const std::string & | Title, |
| llvm::StringLiteral | Kind, | ||
| const std::string & | FileURI, | ||
| const lspserver::Range & | EditRange, | ||
| std::string | NewText ) |
Create a CodeAction with a single text edit.
Definition at line 10 of file Utils.cpp.
Referenced by addAttrNameActions(), addConvertToInheritAction(), addFlattenAttrsAction(), addInheritToBindingAction(), addJsonToNixAction(), addPackAttrsAction(), addRewriteStringAction(), and addWithToLetAction().
| std::string nixd::escapeNixString | ( | llvm::StringRef | S | ) |
Escape special characters for Nix double-quoted string literals.
Escapes: " \ ${
\r \t (per Nix Reference Manual)
Definition at line 52 of file Utils.cpp.
Referenced by quoteNixAttrKey().
| nixd::FindAttrPathResult nixd::findAttrPath | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| std::vector< std::string > & | Path ) |
Heuristically find attrpath suitable for "attrpath" completion.
| [out] | Path | the attrpath. |
Definition at line 283 of file AST.cpp.
References nixf::ParentMapAnalysis::upTo().
Referenced by findAttrPathForOptions().
| nixd::FindAttrPathResult nixd::findAttrPathForOptions | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM, | ||
| std::vector< std::string > & | Path ) |
Heuristically find attrpath suitable for "attrpath" completion. Strips "config." from the start to support config sections in NixOS modules.
| [out] | Path | the attrpath. |
Definition at line 320 of file AST.cpp.
References findAttrPath(), and OK.
| const Definition & nixd::findDefinition | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PMA, | ||
| const nixf::VariableLookupAnalysis & | VLA ) |
Heuristically find definition on some node.
Definition at line 366 of file Definition.cpp.
References nixf::Node::kind().
| int nixd::forkPiped | ( | int & | In, |
| int & | Out, | ||
| int & | Err ) |
fork this process and create some pipes connected to the new process.
stdin, stdout, stderr in the new process will be closed, and these fds could be used to communicate with it.
Definition at line 8 of file ForkPiped.cpp.
Referenced by nixd::StreamProc::StreamProc().
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| AttrPathCompleteParams & | R, | ||
| llvm::json::Path | P ) |
Definition at line 117 of file AttrSet.cpp.
References nixd::AttrPathCompleteParams::Prefix, and nixd::AttrPathCompleteParams::Scope.
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| AttrPathInfoResponse & | R, | ||
| llvm::json::Path | P ) |
Definition at line 104 of file AttrSet.cpp.
References nixd::AttrPathInfoResponse::Meta, nixd::AttrPathInfoResponse::PackageDesc, and nixd::AttrPathInfoResponse::ValueDesc.
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| Configuration & | R, | ||
| llvm::json::Path | P ) |
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| Configuration::Diagnostic & | R, | ||
| llvm::json::Path | P ) |
Referenced by fromJSON(), and parseCLIConfig().
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| Configuration::Formatting & | R, | ||
| llvm::json::Path | P ) |
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| Configuration::NixpkgsProvider & | R, | ||
| llvm::json::Path | P ) |
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| Configuration::OptionProvider & | R, | ||
| llvm::json::Path | P ) |
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| OptionDescription & | R, | ||
| llvm::json::Path | P ) |
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| OptionField & | R, | ||
| llvm::json::Path | P ) |
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| OptionType & | R, | ||
| llvm::json::Path | P ) |
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| PackageDescription & | R, | ||
| llvm::json::Path | P ) |
Definition at line 66 of file AttrSet.cpp.
References nixd::PackageDescription::Description, nixd::PackageDescription::Homepage, nixd::PackageDescription::LongDescription, nixd::PackageDescription::Name, nixd::PackageDescription::PName, nixd::PackageDescription::Position, and nixd::PackageDescription::Version.
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| ValueDescription & | R, | ||
| llvm::json::Path | P ) |
Definition at line 133 of file AttrSet.cpp.
References nixd::ValueDescription::Args, nixd::ValueDescription::Arity, and nixd::ValueDescription::Doc.
| bool nixd::fromJSON | ( | const llvm::json::Value & | Params, |
| ValueMeta & | R, | ||
| llvm::json::Path | P ) |
Definition at line 87 of file AttrSet.cpp.
References nixd::ValueMeta::Location, and nixd::ValueMeta::Type.
| T nixd::fromJSON | ( | const llvm::json::Value & | V | ) |
Definition at line 32 of file JSON.h.
References fromJSON().
| int nixd::getLSPSeverity | ( | nixf::Diagnostic::DiagnosticKind | Kind | ) |
Definition at line 11 of file Convert.cpp.
References nixf::Diagnostic::DS_Error, nixf::Diagnostic::DS_Fatal, nixf::Diagnostic::DS_Hint, nixf::Diagnostic::DS_Info, nixf::Diagnostic::DS_Warning, and nixf::Diagnostic::severity().
| std::pair< std::vector< std::string >, std::string > nixd::getScopeAndPrefix | ( | const nixf::Node & | N, |
| const nixf::ParentMapAnalysis & | PM ) |
get variable scope, and it's prefix name.
Nixpkgs has some packages scoped in "nested" attrs. e.g. llvmPackages, pythonPackages. Try to find these name as a pre-selected scope, the last value is "prefix".
Definition at line 274 of file AST.cpp.
References nixf::Node::kind().
|
nodiscard |
Determine whether or not some node has enclosed "with pkgs; [ ]".
Yes, this evaluation isn't flawless. What if the identifier isn't "pkgs"? We can't dynamically evaluate everything each time and invalidate them immediately after document updates. Therefore, this heuristic method represents a trade-off between performance considerations.
Definition at line 108 of file AST.cpp.
References nixf::ExprVar::id(), nixf::EnvNode::isWith(), nixf::Node::kind(), nixf::Identifier::name(), nixf::EnvNode::parent(), nixf::EnvNode::syntax(), upEnv(), and nixf::ExprWith::with().
| bool nixd::isValidNixIdentifier | ( | const std::string & | S | ) |
Check if a string is a valid Nix identifier that can be unquoted.
Valid identifiers: start with letter or underscore, contain letters, digits, underscores, hyphens, or single quotes. Must not be a keyword.
Definition at line 27 of file Utils.cpp.
Referenced by addAttrNameActions(), and quoteNixAttrKey().
| llvm::json::Value nixd::parse | ( | llvm::StringRef | JSON | ) |
Definition at line 5 of file JSON.cpp.
Referenced by parseCLIConfig().
| Configuration nixd::parseCLIConfig | ( | ) |
Parse the CLI flag and initialize the config nixd::DefaultConfig.
Definition at line 25 of file CommandLine/Configuration.cpp.
References fromJSON(), and parse().
| std::string nixd::quoteNixAttrKey | ( | const std::string & | Key | ) |
Quote and escape a Nix attribute key if necessary.
Returns the key as-is if it's a valid identifier, otherwise quotes and escapes special characters using escapeNixString().
Definition at line 89 of file Utils.cpp.
References escapeNixString(), and isValidNixIdentifier().
Referenced by addConvertToInheritAction(), addPackAttrsAction(), and addToFormalsAction().
|
inline |
Resolve a Nix expression path to a real filesystem path.
This function resolves relative paths against the base file's directory, handles directory → default.nix conversion, and validates the result.
Used by both DocumentLink (for clickable links) and Definition (for go-to-definition on path literals).
| BasePath | The path of the file containing the path literal. |
| ExprPath | The path literal string from the Nix expression. |
Definition at line 28 of file PathResolve.h.
References lspserver::elog(), and lspserver::vlog().
| void nixd::startAttrSetEval | ( | const std::string & | Name, |
| std::unique_ptr< AttrSetClientProc > & | Worker ) |
Definition at line 24 of file Launch.cpp.
References nixd::AttrSetClient::getExe().
Referenced by startNixpkgs(), and startOption().
| void nixd::startNixpkgs | ( | std::unique_ptr< AttrSetClientProc > & | NixpkgsEval | ) |
Definition at line 32 of file Launch.cpp.
References startAttrSetEval().
| void nixd::startOption | ( | const std::string & | Name, |
| std::unique_ptr< AttrSetClientProc > & | Worker ) |
Definition at line 36 of file Launch.cpp.
References NULL_DEVICE, and startAttrSetEval().
| Value nixd::toJSON | ( | const AttrPathCompleteParams & | Params | ) |
Definition at line 114 of file AttrSet.cpp.
References lspserver::Object, nixd::AttrPathCompleteParams::Prefix, and nixd::AttrPathCompleteParams::Scope.
| Value nixd::toJSON | ( | const AttrPathInfoResponse & | Params | ) |
Definition at line 96 of file AttrSet.cpp.
References nixd::AttrPathInfoResponse::Meta, lspserver::Object, nixd::AttrPathInfoResponse::PackageDesc, and nixd::AttrPathInfoResponse::ValueDesc.
| Value nixd::toJSON | ( | const OptionDescription & | Params | ) |
Definition at line 20 of file AttrSet.cpp.
References nixd::OptionDescription::Declarations, nixd::OptionDescription::Definitions, nixd::OptionDescription::Description, nixd::OptionDescription::Example, lspserver::Object, and nixd::OptionDescription::Type.
| Value nixd::toJSON | ( | const OptionField & | Params | ) |
Definition at line 40 of file AttrSet.cpp.
References nixd::OptionField::Description, nixd::OptionField::Name, and lspserver::Object.
| Value nixd::toJSON | ( | const OptionType & | Params | ) |
Definition at line 6 of file AttrSet.cpp.
References nixd::OptionType::Description, nixd::OptionType::Name, and lspserver::Object.
| Value nixd::toJSON | ( | const PackageDescription & | Params | ) |
Definition at line 54 of file AttrSet.cpp.
References nixd::PackageDescription::Description, nixd::PackageDescription::Homepage, nixd::PackageDescription::LongDescription, nixd::PackageDescription::Name, lspserver::Object, nixd::PackageDescription::PName, nixd::PackageDescription::Position, and nixd::PackageDescription::Version.
| llvm::json::Value nixd::toJSON | ( | const ValueDescription & | Params | ) |
Definition at line 126 of file AttrSet.cpp.
References nixd::ValueDescription::Args, nixd::ValueDescription::Arity, nixd::ValueDescription::Doc, and lspserver::Object.
| Value nixd::toJSON | ( | const ValueMeta & | Params | ) |
Definition at line 80 of file AttrSet.cpp.
References nixd::ValueMeta::Location, lspserver::Object, and nixd::ValueMeta::Type.
| lspserver::Position nixd::toLSPPosition | ( | llvm::StringRef | Code, |
| const nixf::LexerCursor & | P ) |
Definition at line 27 of file Convert.cpp.
References nixf::LexerCursor::offset(), and lspserver::offsetToPosition().
Referenced by addToFormalsAction(), and toLSPRange().
| lspserver::Range nixd::toLSPRange | ( | llvm::StringRef | Code, |
| const nixf::LexerCursorRange & | R ) |
Definition at line 40 of file Convert.cpp.
References nixf::LexerCursorRange::lCur(), nixf::LexerCursorRange::rCur(), and toLSPPosition().
Referenced by addAttrNameActions(), addConvertToInheritAction(), addExtractToFileAction(), addFlattenAttrsAction(), addInheritToBindingAction(), addPackAttrsAction(), addRewriteStringAction(), and addWithToLetAction().
| llvm::SmallVector< lspserver::DiagnosticTag, 1 > nixd::toLSPTags | ( | const std::vector< nixf::DiagnosticTag > & | Tags | ) |
Definition at line 47 of file Convert.cpp.
References lspserver::Deprecated, nixf::Faded, nixf::Striked, and lspserver::Unnecessary.
| nixf::Position nixd::toNixfPosition | ( | const lspserver::Position & | P | ) |
Definition at line 32 of file Convert.cpp.
References lspserver::Position::character, and lspserver::Position::line.
Referenced by toNixfRange().
| nixf::PositionRange nixd::toNixfRange | ( | const lspserver::Range & | P | ) |
Definition at line 36 of file Convert.cpp.
References lspserver::Range::end, lspserver::Range::start, and toNixfPosition().
|
nodiscard |
Search up until there are some node associated with "EnvNode".
Definition at line 98 of file AST.cpp.
References nixf::VariableLookupAnalysis::env(), nixf::ParentMapAnalysis::isRoot(), and nixf::ParentMapAnalysis::query().
Referenced by havePackageScope().
|
extern |
Indicating that we are in lit-test mode.
Definition at line 8 of file Options.cpp.
|
constexpr |
|
constexpr |
|
extern |