apex-dev-tools / apex-ls

Apex language server library
Other
2 stars 1 forks source link

Better completion handling on field/var declaration = n #283

Closed kjonescertinia closed 3 months ago

kjonescertinia commented 3 months ago

This changes code completion handling for when the new keyword can be used. If it is preceded by typeName identifier = and the typeName to a type with either a no arg constructor or an SObject then we replace the keyword suggestions by new typeName();

It might be possible to support other uses cases where new is being used, such as just assigning to vars, but this matches the feature request and is probably the most common case so I have just supported on declarations.

The PR has some improvements for typeName parsing as we were not handling whitespace very well.