intellij-kubernetes icon indicating copy to clipboard operation
intellij-kubernetes copied to clipboard

code completion feels a bit bumpy...

Open mkrumpholz opened this issue 6 years ago • 2 comments

First i had a bit trouble getting anything in a code completion popup, there was nothing. Then i found out that the completion starts to work on empty lines. From the java world in IntelliJ IDEA i'm used to activating code completion nearly everewhere and also with a useful result most of the time. Could you look for this one?

Maybe it's too strict when integrating with the IDE (when calling CompletionContributor.extend())... I did completion with a self-written plugin too but it worked using PsiReference.getVariants(). So i can only guess here. :)

mkrumpholz avatar Mar 01 '18 13:03 mkrumpholz

Hey, could elaborate a little more on what you're expecting to see? The completion mainly only works consistently for keys in a YAML file. It will only suggest values for boolean properties, and the kind and apiVersion properties. Most of the time there isn't really anything to complete for a value - e.g. properties like image name, memory limit, etc can be anything.

I guess one notable omission here is that it doesn't suggest values for enum-type properties (e.g. imagePullPolicy doesn't offer value completion for the Always, IfNotPresent, and Never). This is because it gets all its information from the Kubernetes swagger API specs, so we're restricted to what can be gained from those definition files (at least in the current design).

If you have any specific examples of YAML where completion is missing I'd be interested to hear! If you find its not suggesting compeltion for keys within a valid Kubernetes resource then that is likely a bug.

tinselspoon avatar Mar 02 '18 05:03 tinselspoon

apiVersion: v1
kind: Service
metadata:
  annotations:
  1. when cursor is anywhere on annotations line: no completion result - has to be a new and empty line or incomplete to get a result This is very different to the java world, i'd expect to see results even if the current line is complete and correct, maybe to add or change something.
  2. assuming cursor in a new empty line right after metadata: completion shows different results depending on the position within the line This may be ok to if all users know the structure of YAML and kubernetes templates good enough. A better solution could be showing all possible elemtents for the current level (indentation) and below/above with some visible distinction in the ui popup. Would be a smarter completion all IDEA users know and like in the IDE itself. :)

mkrumpholz avatar Mar 02 '18 09:03 mkrumpholz