nixd
Toggle main menu visibility
Loading...
Searching...
No Matches
nixd
lib
Controller
CodeActions
AddToFormals.h
Go to the documentation of this file.
1
/// \file
2
/// \brief Code action for adding undefined variables to lambda formals.
3
///
4
/// Transforms: {x}: y -> {x, y}: y
5
/// This adds undefined variables to the formal parameter list of a lambda.
6
7
#pragma once
8
9
#include <
lspserver/Protocol.h
>
10
11
#include <
nixf/Sema/ParentMap.h
>
12
#include <
nixf/Sema/VariableLookup.h
>
13
14
#include <llvm/ADT/StringRef.h>
15
16
#include <string>
17
#include <vector>
18
19
namespace
nixf
{
20
class
Node
;
21
}
// namespace nixf
22
23
namespace
nixd
{
24
25
/// \brief Add code action to add undefined variable to lambda formals.
26
///
27
/// This action is offered when:
28
/// - The cursor is on an ExprVar (variable reference)
29
/// - The variable is undefined (not found in any scope)
30
/// - The enclosing lambda has a formals parameter list (e.g., {x, y}: body)
31
///
32
/// The action is NOT offered when:
33
/// - The variable is already defined in any scope
34
/// - There is no enclosing lambda
35
/// - The enclosing lambda uses simple argument style (x: body) instead of
36
/// formals
37
///
38
/// Transformation example: `{x}: y` -> `{x, y}: y`
39
void
addToFormalsAction
(
const
nixf::Node &N,
const
nixf::ParentMapAnalysis &PM,
40
const
nixf::VariableLookupAnalysis &VLA,
41
const
std::string &FileURI, llvm::StringRef Src,
42
std::vector<lspserver::CodeAction> &Actions);
43
44
}
// namespace nixd
ParentMap.h
ParentMap analysis.
VariableLookup.h
Lookup variable names, from it's parent scope.
nixf::Node
Definition
Basic.h:12
Protocol.h
nixd
Definition
CommandLine/Configuration.h:9
nixd::addToFormalsAction
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.
Definition
AddToFormals.cpp:20
nixf
Definition
Diagnostic.h:19
Generated by
1.17.0