FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
flutter-tools.nvim/lua/flutter-tools.lua at main · nvim-flutter/flutter-tools.nvim · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
nvim-flutter
/
flutter-tools.nvim
Public
Notifications
You must be signed in to change notification settings
Fork
116
Star
1.4k
Code
Issues
20
Pull requests
9
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
flutter-tools.nvim
/
lua
/
flutter-tools.lua
Copy path
More file actions
More file actions
Latest commit
History
History
History
137 lines (123 loc) · 4.86 KB
Breadcrumbs
flutter-tools.nvim
/
lua
/
flutter-tools.lua
Copy path
File metadata and controls
137 lines (123 loc) · 4.86 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
local
M
=
{}
local
lazy
=
require
(
"
flutter-tools.lazy
"
)
local
commands
=
lazy
.
require
(
"
flutter-tools.commands
"
)
---
@module
"
flutter-tools.commands
"
local
config
=
lazy
.
require
(
"
flutter-tools.config
"
)
---
@module
"
flutter-tools.config
"
local
dev_tools
=
lazy
.
require
(
"
flutter-tools.dev_tools
"
)
---
@module
"
flutter-tools.dev_tools
"
local
dap
=
lazy
.
require
(
"
flutter-tools.dap
"
)
---
@module
"
flutter-tools.dap
"
local
decorations
=
lazy
.
require
(
"
flutter-tools.decorations
"
)
---
@module
"
flutter-tools.decorations
"
local
guides
=
lazy
.
require
(
"
flutter-tools.guides
"
)
---
@module
"
flutter-tools.guides
"
local
log
=
lazy
.
require
(
"
flutter-tools.log
"
)
---
@module
"
flutter-tools.log
"
local
lsp
=
lazy
.
require
(
"
flutter-tools.lsp
"
)
---
@module
"
flutter-tools.lsp
"
local
outline
=
lazy
.
require
(
"
flutter-tools.outline
"
)
---
@module
"
flutter-tools.outline
"
local
devices
=
lazy
.
require
(
"
flutter-tools.devices
"
)
---
@module
"
flutter-tools.devices
"
local
utils
=
lazy
.
require
(
"
flutter-tools.utils
"
)
---
@module
"
flutter-tools.utils
"
local
api
=
vim
.
api
local
command
=
function
(
name
,
callback
,
opts
)
api
.
nvim_create_user_command
(
name
,
callback
,
opts
or
{})
end
local
function
setup_commands
()
--
Commands
command
(
"
FlutterRun
"
,
function
(
data
)
commands
.
run_command
(
data
.
args
)
end
, {
nargs
=
"
*
"
})
command
(
"
FlutterDebug
"
,
function
(
data
)
commands
.
run_command
(
data
.
args
,
true
)
end
, {
nargs
=
"
*
"
})
command
(
"
FlutterLspRestart
"
,
lsp
.
restart
)
command
(
"
FlutterAttach
"
,
function
(
data
)
commands
.
attach
(
data
.
args
)
end
, {
nargs
=
"
*
"
})
command
(
"
FlutterDetach
"
,
commands
.
detach
)
command
(
"
FlutterReload
"
,
commands
.
reload
)
command
(
"
FlutterRestart
"
,
commands
.
restart
)
command
(
"
FlutterQuit
"
,
commands
.
quit
)
command
(
"
FlutterVisualDebug
"
,
commands
.
visual_debug
)
command
(
"
FlutterChangeTargetPlatform
"
,
commands
.
change_target_platform
)
command
(
"
FlutterToggleBrightness
"
,
commands
.
brightness
)
--
Lists
command
(
"
FlutterDevices
"
,
devices
.
list_devices
)
command
(
"
FlutterEmulators
"
,
devices
.
list_emulators
)
---
Outline
command
(
"
FlutterOutlineOpen
"
,
outline
.
open
)
command
(
"
FlutterOutlineToggle
"
,
outline
.
toggle
)
---
Dev tools
command
(
"
FlutterDevTools
"
,
dev_tools
.
start
)
command
(
"
FlutterDevToolsActivate
"
,
dev_tools
.
activate
)
command
(
"
FlutterCopyProfilerUrl
"
,
commands
.
copy_profiler_url
)
command
(
"
FlutterOpenDevTools
"
,
commands
.
open_dev_tools
)
command
(
"
FlutterInspectWidget
"
,
commands
.
inspect_widget
)
command
(
"
FlutterPubGet
"
,
commands
.
pub_get
)
command
(
"
FlutterPubUpgrade
"
,
function
(
data
)
commands
.
pub_upgrade_command
(
data
.
args
)
end
, {
nargs
=
"
*
"
,
})
---
Log
command
(
"
FlutterLogClear
"
,
log
.
clear
)
command
(
"
FlutterLogToggle
"
,
log
.
toggle
)
---
LSP
command
(
"
FlutterSuper
"
,
lsp
.
dart_lsp_super
)
command
(
"
FlutterReanalyze
"
,
lsp
.
dart_reanalyze
)
command
(
"
FlutterRename
"
,
function
()
require
(
"
flutter-tools.lsp.rename
"
).
rename
()
end
)
end
local
_setup_started
=
false
---
Initialise various plugin modules
local
function
start
()
if
not
_setup_started
then
_setup_started
=
true
setup_commands
()
dap
.
setup
(
config
)
if
config
.
widget_guides
.
enabled
then
guides
.
setup
()
end
if
config
.
decorations
then
decorations
.
apply
(
config
.
decorations
)
end
end
end
local
AUGROUP
=
api
.
nvim_create_augroup
(
"
FlutterToolsGroup
"
, {
clear
=
true
})
---
Create autocommands for the plugin
local
function
setup_autocommands
()
local
autocmd
=
api
.
nvim_create_autocmd
--
delay plugin setup till we enter a dart file
autocmd
({
"
BufEnter
"
}, {
group
=
AUGROUP
,
pattern
=
{
"
*.dart
"
,
"
pubspec.yaml
"
},
once
=
true
,
callback
=
start
,
})
if
config
.
lsp
.
color
.
enabled
then
autocmd
({
"
BufEnter
"
,
"
TextChanged
"
,
"
InsertLeave
"
}, {
group
=
AUGROUP
,
pattern
=
{
"
*.dart
"
},
callback
=
function
()
lsp
.
document_color
()
end
,
})
--
NOTE: we piggyback of this event to check for when the server is first initialized
autocmd
({
"
User
"
}, {
group
=
AUGROUP
,
pattern
=
utils
.
events
.
LSP_ANALYSIS_COMPLETED
,
once
=
true
,
callback
=
function
()
lsp
.
document_color
()
end
,
})
end
autocmd
({
"
BufWritePost
"
}, {
group
=
AUGROUP
,
pattern
=
{
"
*.dart
"
},
callback
=
function
()
commands
.
reload
(
true
)
end
,
})
autocmd
({
"
BufWritePost
"
}, {
group
=
AUGROUP
,
pattern
=
{
"
*/pubspec.yaml
"
},
callback
=
function
()
commands
.
pub_get
()
end
,
})
autocmd
({
"
BufEnter
"
}, {
group
=
AUGROUP
,
pattern
=
{
log
.
filename
},
callback
=
function
()
log
.
__resurrect
()
end
,
})
autocmd
({
"
VimLeavePre
"
}, {
group
=
AUGROUP
,
pattern
=
{
"
*
"
},
callback
=
function
()
dev_tools
.
stop
()
end
,
})
end
---
@param
opts
flutter.ProjectConfig
|
flutter.ProjectConfig[] Project-specific configuration
function
M
.
setup_project
(
opts
)
config
.
setup_project
(
opts
)
start
()
end
---
Entry point for this plugin
---
@param
user_config
flutter.Config Configuration options for flutter-tools
function
M
.
setup
(
user_config
)
config
.
set
(
user_config
)
setup_autocommands
()
end
return
M
Back
|
FazBrowse Home
|
New Git URL