spring-attic / spring-ide

Spring Development Environment for Eclipse
300 stars 126 forks source link

Yaml and properties editor: support camel-case in completions #246

Open selimok opened 6 years ago

selimok commented 6 years ago

Hi,

I think the feature request described here https://jira.spring.io/browse/STS-4228 is not yet implemented. The original issue is closed and has been linked to this address https://www.pivotaltracker.com/story/show/118023107 but the resource is no more available.

It would be nice if the spring yaml editor supports camel case suggestions.

Thanks.

selimok commented 6 years ago

Oh I see now. After reading the source code I understand where the problem is. Camel case support is there but interfered with the plugin org.springframework.ide.eclipse.cloudfoundry.manifest.editor . After uninstalling this plugin now all suggestions are in camel case.

I let the issue open, to let the decision making to original developers. I'm not sure if this a bug or a normal behaviour. May be the best option is giving a configuration option to user, to choose between camel case or hyphens.

kdvolder commented 6 years ago

The tracker story is still there but I guess it is not accessible to the public :-( Public visibility of our tracker tickets is something we have lost in the transition. Should probably have talk amongst ourselves if / how to get it back.

Now, back to the camelCase issue. As far as I know we never implemented it, so I'm a little surprised how you (@selimok) figured out to get it working. Do you have a pointer to the code you are talking about?

selimok commented 6 years ago

Now I'm surprised too :)

For 3 days I was sure enough that I saw the camelCase suggestions, but now I checked again and sadly I can say I probably dreamed about (think a saw the corresponding class names on the right side of property suggestions).

The class I mentioned was following: https://github.com/spring-projects/spring-ide/blob/master/plugins/org.springframework.ide.eclipse.boot.properties.editor.yaml/src/org/springframework/ide/eclipse/boot/properties/editor/yaml/ApplicationYamlStructureProvider.java

Since it contains hypens to camelCase call I thought it is already implemented.

    private static final KeyAliases KEY_ALIASES = new KeyAliases() {
        @Override
        public Iterable<String> getKeyAliases(String base) {
            String camelCased = StringUtil.hyphensToCamelCase(base, false);
            if (!camelCased.equals(base)) {
                return Collections.singletonList(camelCased);
            }
            return Collections.emptyList();
        }
    };

Is this code part unrelated to suggestions?

kdvolder commented 6 years ago

We tolerate camelCase if the user writes it, or it already exists in a yaml file they might have inherited. We figured seeing false errors/warnings for them would be very annoying. But on completions we just suggest the canonical names. The code you saw relates to 'tolerating' camel case rather than suggesting it.

To be honest with you, the name aliasing rules in boot are really kind of messy and not even very well defined. I am not to keen on adding more complexity around supporting them than we already have.

So the question really is, how badly do you really want to write your names in camelCase? So far you are really the only user that has ever asked for this. So we'd probably not want to implement this if we can avoid it.

selimok commented 6 years ago

My convention is to use camelCase. But I cannot force you to implement this. I don't want to cause a headache if it's really difficult to implement. So the decision is up to you. The feature is nice to have but not must to have.

Thanks.

kdvolder commented 6 years ago

Thanks, we'll keep your request in mind. But I won't promise anything beyond that.