LSP: Sublime Text Becomes unresponsive when hovered on variable containing large data (Variable Storing embeded font data)

Sublime Text Freezes when hovering over a variable holding large data

I am trying to load a font from an file which contains embedded font data as represented below. When ever I am using the variable FontAwesomeRegular and hovering over the variable the sublime text becomes unresponsive.

For Example

inline unsigned char FontAwesomeRegular[190016] = {
	0x4F, 0x54, 0x54, 0x4F, 0x00, 0x0A, 0x00, 0x80, 0x00, 0x03, 0x00, 0x20,
	0x43, 0x46, 0x46, 0x20, 0x1D, 0xD7, 0xBE, 0xB6, 0x00, 0x00, 0x7D, 0xAC,
	0x00, 0x02, 0x48, 0x50, 0x47, 0x53, 0x55, 0x42, 0xBE, 0xB5, 0xF3, 0x69,
	0x00, 0x02, 0xC9, 0x58, 0x00, 0x00, 0x1C, 0xE6, 0x4F, 0x53, 0x2F, 0x32,
	0x5F, 0x56, 0xDE, 0x6E, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, ...   ]

Some Other File

const int fa_regular_size = IM_ARRAYSIZE(FontAwesomeRegular);
io.Fonts->AddFontFromMemoryTTF((void*)FontAwesomeRegular, fa_regular_size , font_size, &font_config);

Here When I am using FontAwesomeRegular variable in a different file and if I accidently hover over the variable FontAwesomeRegular the sublime text freezes and becomes unresponsive for 50-80 seconds.

The sublime text is trying to load all the details related to the variable in order to display it in variable detail popup and since the data is about almost a size of 1 MB. It is struggling and the sublime text becomes unresponsive.

If there are some fixes please do suggest

OS: Windows 11 Sublime Build: 4169

About this issue

  • Original URL
  • State: open
  • Created 5 months ago
  • Comments: 16 (12 by maintainers)

Most upvoted comments

Hover response for reference:

{
  "contents": {
    "kind": "markdown",
    "value": "### variable `FontAwesomeRegular`  \n\n---\nType: `unsigned char[190016]`  \n\n---\n```cpp\nunsigned char FontAwesomeRegular[190016] = {\n    0x4F, 0x54, 0x54, 0x4F, 0x00, 0x0A, 0x00, 0x80, 0x00, 0x03, 0x00, 0x20,\n    0x43, 0x46, 0x46, 0x20, 0x1D, 0xD7, 0xBE, 0xB6, 0x00, 0x00, 0x7D, 0xAC,\n    0x00, 0x02, 0x48, 0x50, 0x47, 0x53, 0x55, 0x42, 0xBE, 0xB5, 0xF3, 0x69,\n    0x00, 0x02, 0xC9, 0x58, 0x00, 0x00, 0x1C, 0xE6, 0x4F, 0x53, 0x2F, 0x32,\n    0x5F, 0x56, 0xDE, 0x6E, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00}\n```"
  },
  "range": {
    "end": {
      "character": 39,
      "line": 0
    },
    "start": {
      "character": 21,
      "line": 0
    }
  }
}

The blame could be put anywhere from clangd, ST, mdpopups to LSP 😃 Hard to say who should handle this better. It wouldn’t fix the root issue but I feel like clangd should avoid showing such big outputs (maybe trim or elide in such cases).