Hide inline errors (phantoms) in Sublime Text 4

360 Views Asked by At

The following used to work in Sublime Text 3, but gives an error in ST4.

{
  "keys": ["f10"],
  "command": "exec",
  "args": {"hide_phantoms_only" : true },
},

Error message: __init__() got an unexpected keyword argument 'hide_phantoms_only'.

Similar to my previous question here How to hide Sublime inline errors (phantoms) with Escape, but the solution no longer works in Sublime Text 4.

1

There are 1 best solutions below

0
On BEST ANSWER

That’s because in ST4, phantoms are no longer used to show build errors. They have been replaced by something called region annotations.

Sublime Text 3: Uses Inline phantoms

enter image description here

Sublime Text 4: Uses the so called region annotations, that appears on the far right edge of the view. This was done mainly to reduce reflow of the document (since phantoms can cause text to shift around, which results in a somewhat janky experience).

enter image description here

Error message: init() got an unexpected keyword argument 'hide_phantoms_only'

Coming back to this, since phantoms are no longer used in ST4 to show build errors, any phantom related arguments that the exec command used to take is also no longer valid. Hence, the error.

Currently, I don’t think there is a way to have a key binding that will close all the error annotations, though there is an open feature request to make annotations more key board friendly (& closing all annotations is a part of that issue)

https://github.com/sublimehq/sublime_text/issues/3422