nixd
Loading...
Searching...
No Matches
nixd
lib
Controller
CodeActions
PackAttrs.h
Go to the documentation of this file.
1
/// \file
2
/// \brief Code action for packing dotted attribute paths into nested sets.
3
///
4
/// Transforms: { foo.bar = 1; } -> { foo = { bar = 1; }; }
5
/// Also offers bulk pack when siblings share a prefix:
6
/// { foo.bar = 1; foo.baz = 2; } -> { foo = { bar = 1; baz = 2; }; }
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
19
namespace
nixf
{
20
class
Node
;
21
}
// namespace nixf
22
23
namespace
nixd
{
24
25
/// \brief Add pack action for dotted attribute paths.
26
///
27
/// This action is offered when the cursor is on a binding with a dotted path
28
/// (e.g., foo.bar = 1). It offers three variants:
29
/// - Pack One: pack only the current binding
30
/// - Shallow Pack All: pack all siblings sharing the same first segment
31
/// - Recursive Pack All: fully nest all siblings
32
void
addPackAttrsAction
(
const
nixf::Node &N,
const
nixf::ParentMapAnalysis &PM,
33
const
std::string &FileURI, llvm::StringRef Src,
34
std::vector<lspserver::CodeAction> &Actions);
35
36
}
// namespace nixd
ParentMap.h
ParentMap analysis.
nixf::Node
Definition
Basic.h:12
Protocol.h
nixd
Definition
CommandLine/Configuration.h:9
nixd::addPackAttrsAction
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.
Definition
PackAttrs.cpp:187
nixf
Definition
Diagnostic.h:19
Generated by
1.15.0