VSCode naming conflict issue

So I made a project in processing and I used VSCode processing extension as the editor. In the code I created:

abstract class Obstacle{...}
class Rectangle extends Obstacle{...}
class Beam extends Obstacle{...}
class Ellipse extends Obstacle{...}

And then the editor popped out the error:

The class “Beam” cannot have the same name as your sketch or its enclosing class

When I renamed the Beam class to something else, the error disappears shortly, but when I restarted VSCode it appears again, no matter what I rename it to. Weirdly other classes did not error, which have the exact same inheritance and structure.

I didn’t get this error using the processing.org’s editor, so that’s kinda weird. Does anyone using VSCode know if it’s an editor issue or my code issue?