'Can not erase bad character in custom IntelliJ plugin

I am creating custom language plugin for IntelliJ.

I implemented syntax highlighting and it works fine.

Tokens tree is built correctly too but when I type unexpected token something strange happens.

For example backspace key doesn't erase character. What is more interesting for me is that I can erase this incorrect character using shift, arrow and backspace.

Second example of strange behaving is total code editor crashing.

Does anybody have any ideas how to fix it?

It is PSI viewer after typing some unexpected things

PSI viewer

Here I can't erase character at all enter image description here



Solution 1:[1]

The compiler looks for the usual places like /usr/include for files.

One way to achieve this if you know your compiler already looks at /usr/include for include files anyway, is the following instead:

#include "test/head1.h"

This would be a good approach if you plan to include no more files from /usr/include/test and you know no other include directory has files with similar name to avoid conflict.

Other method would be to give compiler a hint for the directory while compiling:

gcc -I/usr/include/test <other-options> yourcode.c

Have fun writing C!

Solution 2:[2]

The answer above mine is correct, but I just wanted to add some advice pertaining to making the #include that you want work if you're using CMake.

If you're using CMake, you can add the path up till your header in CMakeLists.txt, like so:

target_include_directories(<projectname> PUBLIC path/to/headers), and you can add as many paths as you want, separated by spaces.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 the_bond_007
Solution 2 Anish Sinha