nixd
Loading...
Searching...
No Matches
InheritToBinding.h
Go to the documentation of this file.
1/// \file
2/// \brief Code action for converting inherit to explicit binding.
3///
4/// Offers to convert inherit statements to explicit bindings:
5/// - { inherit x; } -> { x = x; }
6/// - { inherit (b) a; } -> { a = b.a; }
7
8#pragma once
9
10#include <lspserver/Protocol.h>
11
12#include <nixf/Sema/ParentMap.h>
13
14#include <llvm/ADT/StringRef.h>
15
16#include <string>
17#include <vector>
18
19namespace nixf {
20class Node;
21} // namespace nixf
22
23namespace nixd {
24
25/// \brief Add code action to convert inherit to explicit binding.
26///
27/// This action converts inherit statements to explicit bindings:
28/// - Simple inherit: { inherit x; } -> { x = x; }
29/// - Inherit from expression: { inherit (b) a; } -> { a = b.a; }
30///
31/// The action is only offered when the inherit has exactly one name.
32void addInheritToBindingAction(const nixf::Node &N,
33 const nixf::ParentMapAnalysis &PM,
34 const std::string &FileURI, llvm::StringRef Src,
35 std::vector<lspserver::CodeAction> &Actions);
36
37} // namespace nixd
ParentMap analysis.
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.