nixd
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
nixd Namespace Reference

Namespaces

namespace  idioms
 
namespace  rpc
 
namespace  rpcMethod
 
namespace  util
 

Classes

struct  AttrPathCompleteParams
 
struct  AttrPathInfoResponse
 
class  AttrSetClient
 
class  AttrSetClientProc
 
class  AttrSetProvider
 Main RPC class for attrset provider. More...
 
struct  CannotFindVarException
 
struct  Configuration
 
class  Controller
 
class  EvalClient
 
class  EvalProvider
 
class  JSONParseException
 
class  JSONSchemaException
 
class  LLVMErrorException
 
class  NixTU
 Holds analyzed information about a document. More...
 
struct  OptionDescription
 
struct  OptionField
 
struct  OptionType
 
class  OwnedEvalClient
 
struct  PackageDescription
 
struct  StreamProc
 
struct  ValueMeta
 General metadata of all nix::Values. More...
 

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 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 >
fromJSON (const llvm::json::Value &V)
 
const nixf::EnvNodeupEnv (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.
 
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::DefinitionfindDefinition (const nixf::Node &N, const nixf::ParentMapAnalysis &PMA, const nixf::VariableLookupAnalysis &VLA)
 Heuristically find definition on some node.
 

Variables

llvm::cl::OptionCategory NixdCategory
 
llvm::cl::opt< boolLitTest
 Indicating that we are in lit-test mode.
 

Typedef Documentation

◆ AttrPathCompleteResponse

using nixd::AttrPathCompleteResponse = std::vector<std::string>

Definition at line 103 of file AttrSet.h.

◆ AttrPathInfoParams

Definition at line 47 of file AttrSet.h.

◆ EvalExprParams

using nixd::EvalExprParams = std::string

Definition at line 38 of file AttrSet.h.

◆ EvalExprResponse

using nixd::EvalExprResponse = std::optional<std::string>

Definition at line 39 of file AttrSet.h.

◆ OptionCompleteResponse

Definition at line 137 of file AttrSet.h.

◆ OptionInfoParams

Definition at line 45 of file AttrSet.h.

◆ OptionInfoResponse

Definition at line 135 of file AttrSet.h.

◆ PackageInfoParams

Definition at line 44 of file AttrSet.h.

◆ Selector

using nixd::Selector = std::vector<std::string>

A list of strings that "select"s into a attribute set.

Definition at line 42 of file AttrSet.h.

Enumeration Type Documentation

◆ FindAttrPathResult

Enumerator
OK 
Inherit 
NotAttrPath 
WithDynamic 

Definition at line 119 of file AST.h.

Function Documentation

◆ findAttrPath()

nixd::FindAttrPathResult nixd::findAttrPath ( const nixf::Node & N,
const nixf::ParentMapAnalysis & PM,
std::vector< std::string > & Path )

Heuristically find attrpath suitable for "attrpath" completion.

Parameters
[out]Paththe attrpath.

Definition at line 283 of file AST.cpp.

References nixf::ParentMapAnalysis::upTo().

◆ findDefinition()

Heuristically find definition on some node.

Definition at line 344 of file Definition.cpp.

References fromJSON().

◆ forkPiped()

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.

Returns
pid of child process, in parent.
0 in child.

Definition at line 8 of file ForkPiped.cpp.

Referenced by nixd::StreamProc::StreamProc().

◆ fromJSON() [1/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
AttrPathCompleteParams & R,
llvm::json::Path P )

◆ fromJSON() [2/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
AttrPathInfoResponse & R,
llvm::json::Path P )

◆ fromJSON() [3/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
Configuration & R,
llvm::json::Path P )

◆ fromJSON() [4/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
Configuration::Diagnostic & R,
llvm::json::Path P )

◆ fromJSON() [5/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
Configuration::Formatting & R,
llvm::json::Path P )

◆ fromJSON() [6/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
Configuration::NixpkgsProvider & R,
llvm::json::Path P )

◆ fromJSON() [7/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
Configuration::OptionProvider & R,
llvm::json::Path P )

◆ fromJSON() [8/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
OptionDescription & R,
llvm::json::Path P )

◆ fromJSON() [9/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
OptionField & R,
llvm::json::Path P )

◆ fromJSON() [10/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
OptionType & R,
llvm::json::Path P )

◆ fromJSON() [11/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
PackageDescription & R,
llvm::json::Path P )

◆ fromJSON() [12/13]

bool nixd::fromJSON ( const llvm::json::Value & Params,
ValueMeta & R,
llvm::json::Path P )

Definition at line 87 of file AttrSet.cpp.

References fromJSON(), nixd::ValueMeta::Location, and nixd::ValueMeta::Type.

◆ fromJSON() [13/13]

template<class T >
T nixd::fromJSON ( const llvm::json::Value & V)

Definition at line 32 of file JSON.h.

References fromJSON().

◆ getLSPSeverity()

int nixd::getLSPSeverity ( nixf::Diagnostic::DiagnosticKind Kind)

◆ getScopeAndPrefix()

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().

◆ havePackageScope()

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().

◆ parse()

llvm::json::Value nixd::parse ( llvm::StringRef JSON)

Definition at line 5 of file JSON.cpp.

Referenced by parseCLIConfig().

◆ parseCLIConfig()

Configuration nixd::parseCLIConfig ( )

Parse the CLI flag and initialize the config nixd::DefaultConfig.

Definition at line 27 of file CommandLine/Configuration.cpp.

References fromJSON(), and parse().

◆ startAttrSetEval()

void nixd::startAttrSetEval ( const std::string & Name,
std::unique_ptr< AttrSetClientProc > & Worker )

Definition at line 24 of file Launch.cpp.

References fromJSON(), and nixd::AttrSetClient::getExe().

Referenced by startNixpkgs(), and startOption().

◆ startNixpkgs()

void nixd::startNixpkgs ( std::unique_ptr< AttrSetClientProc > & NixpkgsEval)

Definition at line 32 of file Launch.cpp.

References fromJSON(), and startAttrSetEval().

◆ startOption()

void nixd::startOption ( const std::string & Name,
std::unique_ptr< AttrSetClientProc > & Worker )

Definition at line 36 of file Launch.cpp.

References fromJSON(), NULL_DEVICE, and startAttrSetEval().

◆ toJSON() [1/7]

Value nixd::toJSON ( const AttrPathCompleteParams & Params)

Definition at line 112 of file AttrSet.cpp.

References fromJSON(), and lspserver::Object.

◆ toJSON() [2/7]

Value nixd::toJSON ( const AttrPathInfoResponse & Params)

Definition at line 96 of file AttrSet.cpp.

References fromJSON(), and lspserver::Object.

◆ toJSON() [3/7]

Value nixd::toJSON ( const OptionDescription & Params)

Definition at line 20 of file AttrSet.cpp.

References fromJSON(), and lspserver::Object.

◆ toJSON() [4/7]

Value nixd::toJSON ( const OptionField & Params)

Definition at line 40 of file AttrSet.cpp.

References fromJSON(), and lspserver::Object.

◆ toJSON() [5/7]

Value nixd::toJSON ( const OptionType & Params)

Definition at line 6 of file AttrSet.cpp.

References fromJSON(), and lspserver::Object.

◆ toJSON() [6/7]

Value nixd::toJSON ( const PackageDescription & Params)

Definition at line 54 of file AttrSet.cpp.

References fromJSON(), and lspserver::Object.

◆ toJSON() [7/7]

Value nixd::toJSON ( const ValueMeta & Params)

Definition at line 80 of file AttrSet.cpp.

References fromJSON(), and lspserver::Object.

◆ toLSPPosition()

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 toLSPRange().

◆ toLSPRange()

lspserver::Range nixd::toLSPRange ( llvm::StringRef Code,
const nixf::LexerCursorRange & R )

◆ toLSPTags()

llvm::SmallVector< lspserver::DiagnosticTag, 1 > nixd::toLSPTags ( const std::vector< nixf::DiagnosticTag > & Tags)

Definition at line 47 of file Convert.cpp.

References nixf::Faded, lspserver::fromJSON(), and nixf::Striked.

◆ toNixfPosition()

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().

◆ 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().

◆ upEnv()

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().

Variable Documentation

◆ LitTest

opt< bool > nixd::LitTest
extern
Initial value:
{
"lit-test", desc("Indicating that the server is running in lit-test mode."),
init(false), cat(NixdCategory)}

Indicating that we are in lit-test mode.

Definition at line 8 of file Options.cpp.

Referenced by main(), and main().

◆ NixdCategory

OptionCategory nixd::NixdCategory
extern