haskell-language-server/plugins/hls-rename-plugin
awjchen 7385915c99
Get files from Shake VFS from within plugin handlers (#4328)
* Change return type of getFileContents from Text to Rope

- This avoids a few conversions between Rope and Text in the next commit
- Note: Syntactic changes to Development.IDE.Plugin.CodeAction around line
  2000 are to work around the following stylish-haskell failure:

plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs: <string>:2002:5:
error: [GHC-58481]
    parse error (possibly incorrect indentation or mismatched brackets)

* Get virtual files from the Shake VFS in plugins

This commit changes plugins to get virtual files from the Shake VFS
rather than from the language server's VFS.

- Replace `Ide.Types.pluginGetVirtualFile` with
  `Development.IDE.Core.FileStore.getFileContents`
- Replace `Ide.Types.pluginGetVersionedTextDoc` with
  `Development.IDE.Core.FileStore.getVersionedTextDoc`

* Rename `getFileContents` to `getFileModTimeContents`

* Add util functions for common cases of Shake VFS file access

* Cleanup

* Fix warning

* Install notification handlers for cabal files

The cabal formatters read the file contents from the shake VFS. Thus, we
need to make sure there are notification handlers that add the cabal
files to the VFS!

Formatters have to depend on the `hls-cabal-plugin` to have the
necessary notification handlers installed during test time.

---------

Co-authored-by: soulomoon <fwy996602672@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Co-authored-by: Fendor <fendor@posteo.de>
Co-authored-by: fendor <fendor@users.noreply.github.com>
2024-09-28 14:23:35 +02:00
..
src/Ide/Plugin Get files from Shake VFS from within plugin handlers (#4328) 2024-09-28 14:23:35 +02:00
test Remove no-longer-needed compat code, remove unused stuff 2024-06-20 09:03:31 +01:00