File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ All notable changes to this project will be documented in this file.
6
6
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
7
7
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
8
8
9
+ ## [ Unreleased]
10
+
11
+ - Made the ` mod ` snippet handle the case where the module declaration already
12
+ exists.
13
+
9
14
## [ 1.4.1] - 2023-12-05
10
15
11
16
### Fixed
Original file line number Diff line number Diff line change @@ -73,7 +73,11 @@ local get_clients = vim.lsp.get_clients or vim.lsp.get_active_clients
73
73
function util .lsp_get_module_name ()
74
74
if # get_clients { bufnr = 0 } > 0 then
75
75
for _ , lens in pairs (vim .lsp .codelens .get (0 )) do
76
- local name = lens .command .title :match (' module (.*) where' )
76
+ -- Strings to match taken from the module name plugin:
77
+ -- https://github.com/haskell/haskell-language-server/blob/f0c16469046bd554828ea057b5e1f047ad02348e/plugins/hls-module-name-plugin/src/Ide/Plugin/ModuleName.hs#L129-L136
78
+ local name_module_decl_absent = lens .command .title :match (' module (.*) where' )
79
+ local name_module_decl_present = lens .command .title :match (' Set module name to (.*)' )
80
+ local name = name_module_decl_absent or name_module_decl_present
77
81
if name then
78
82
return name
79
83
end
You can’t perform that action at this time.
0 commit comments