Sts4: valid uri's are flagged as errors in git resource

Created on 31 Jan 2019  路  6Comments  路  Source: spring-projects/sts4

The lang server uses github-specific parsing for the uri on the git resource, but that uri can be any valid uri that points to a git instance. Usually not a problem, but if your github url is at eg github.computer.com, that uri gets flagged as

Expecting a ':'

or

Expecting a '/'

image
image

on the p.

It's a rare circumstance, but that value is a uri, not necessarily a github address, so it is a bug. Not huge, but a minor annoyance.

It'll show up for any uri that starts with [email protected] and _not_ [email protected]: or https://github.com and _not_ https://github.com/.

All 6 comments

I'm a little confused at the logic here:
https://github.com/spring-projects/sts4/blob/master/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/github/GithubValueParsers.java#L90
and why it's not just a simple:

if(str.startsWith(expectedPrefix)) {
  return expectedPrefix;
}

is it an attempt to guess what the user _meant_ and give some better suggestion for a common error? How common is it to mess up a github address in that specific way? Everything is right except the ':' or '/' missing?

The logic is just written because we have some special support for github addresses. (It does more than just check the format, but actually uses github rest api, provided you have it setup correctly, to verify the repo exists, it also gives some completion support for repo names etc.).

We (or better, blame that on me personally, who wrote this code) just didn't think much about the other cases.

And no, obviously it isn't correct or logical. But isn't that usually the case when there is a bug? I mean if it was correct and logical then it wouldn't be a bug, would it now :-).

Anyhow, thanks for reporting, it shouldn't be too hard to fix.

neat, thanks. I can take a stab at it if you'd like. Just need to know what's expected.

@shua

I can take a stab at it if you'd like.

Thanks for the generous offer. I already pushed a small change that I think fixes it so your urls no longer get flagged. But we still detect that something like this: [email protected]/spring-projects/sts4.git is wrong. Basically I just added a extra condition so the error is not raised if the character after the 'github.com' is not a '/' or ':'. Turns out this does have a common mistake in mind. I.e. mixing up whether the 'separator' is ':' (for ssh style) or a '/' (for https style).

If you want to try it out you can download a snapshot .vsix file from here:

http://dist.springsource.com/snapshot/STS4/nightly-distributions.html

thanks, tried it out, and it looks like it's fixed

Was this page helpful?
0 / 5 - 0 ratings