spring-attic / spring-ide

Spring Development Environment for Eclipse
299 stars 126 forks source link

Properties/YAML Editors and Map Keys #292

Open garyrussell opened 6 years ago

garyrussell commented 6 years ago

See https://github.com/spring-projects/spring-boot/issues/13555

This syntax is allowed:

logging.level.[org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer]=info

and is required when the logger is for an innner class (contains $).

However, STS flags this as invalid syntax

screen shot 2018-06-22 at 12 23 24 pm

Also, similar keys in YAML are indicated in black:

screen shot 2018-06-22 at 12 24 21 pm

kdvolder commented 6 years ago

I think you can just write:

logging.level.org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer=info

Or doesn't that work?

kdvolder commented 6 years ago

BTW: I think if you are going to use the '[]' notation, which is kind of logical here, I aggree, I think you probably shouldn't add the extra '.'. So like this:

logging.level[org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer]=info

But I checked and STS also doesn't 'approve' of that notation.

I think it is because we are assuming the notation with '[]' is meant for indexing with numbers inside of 'array-like' constructs. If that was ever really the way it worked (?), at least it looks like this is no longer really the case, so this is definitely a bug we should fix.

garyrussell commented 6 years ago

Unfortunately, no; Boot strips out the $ - see the referenced Boot issue.

garyrussell commented 6 years ago

Looks like [...] indicates an index or a map key

 * <p>
 * The "{@code [}" and "{@code ]}" characters may be used to indicate an associative
 * index(i.e. a {@link Map} key or a {@link Collection} index. Indexes names are not
 * restricted and are considered case-sensitive.
garyrussell commented 6 years ago

I just tested it and boot doesn't care whether or not there is a dot before the [..

logging:
  level:
    org.springframework.kafka.listener[KafkaMessageListenerContainer$ListenerConsumer]: info

works too.

and this

logging.level[org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer]: info
kdvolder commented 6 years ago

The STS 'parser' for these '.' and '[]' things probably does care... If I remember correctly. So that's another bug.

garyrussell commented 6 years ago

I've asked on the boot doco issue: https://github.com/spring-projects/spring-boot/issues/13506#issuecomment-399538062

garyrussell commented 6 years ago

The boot team confirmed that both syntaxes are supported (with/without . before [).