How to show syntax errors in an eclipse editor plugin

后端 未结 2 1420
不知归路
不知归路 2021-02-01 00:02

How can I indicate syntax errors (e.g. an illegal sequence of tokens) in an eclipse editor plugin just like in the eclipse Java editor, i.e. by red wriggly underlines, a red mar

2条回答
  •  清歌不尽
    2021-02-01 00:28

    The correct way is using the marker interface.

    Markers are essentially a model that maps marker objects to locations in your source code, so this makes sense in situations where you can have errors in multiple files. (see the IMarker interface)

    A cheaper option if you want to add markup to your current editor but not to all the project is using Annotations, which you can add an remove yourself.

    Markers are represented in the UI as annotations but Eclipse adds and removes the annotations itself. With direct annotations, you're in control.

提交回复
热议问题