haskell / haskell/haskell-language-server

Audit uses of `Rope.toText` and `getFileContents`

Open
#3,720 1 comment 1 reaction 0 assignees View on GitHub
type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

Both of these provide the file contents as `Text`, which can lead to bad performance for operations like "get the subset of the text given by a `Range`". This can be very noticeable on large files.

Generally we should prefer using the `Rope` from the VFS unless we are sure that it's fine, e.g. we're definitely processing it entirely or passing it to another tool.

Suspicious places:
- `extractRange` in the `ghcide` plugins is definitely bad and would be much better operating on `Rope`, generally everything in there operates on `Text` and probably shouldn't.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.