-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/gopls: SQL code highlighted as website URLs #43990
Comments
@stamblerre These links are coming from gopls. Transferring to the gopls issue tracker. minimal repro:
Gopls trace:
|
Thanks for the report. /cc @mvdan, in case some of these cases are unexpected |
I don't think we really need theese links in code. Is it possible to detect URLs in comments only? Why would I need active link in source code? |
And btw the main problem for me is that ugly highlighting not the underlined text itself. |
For syntax highlighting, either file an issue in https://github.com/jeff-hykin/better-go-syntax
|
I don't think that's caused by the semantic highlighting--I expect there is a bug in the way we calculate the positions within this string. Likely it's a mistake in calculating positions on Windows with CRLF line endings. Can you please share a |
I think this is the log:
|
You will need to add
to your settings to get the full detail. |
I think this it the related part of the log. It contains wrong URL.
|
Technically there's over a thousand registered top-level domains, but in practice I imagine that many like If people do find that to be a problem, maybe I can add some API to use a subset of popular TLDs. |
I think that's a good idea. Dot is used for |
We're also discussing using relaxed for comments, but strict for links in strings. Using relaxed for popular TLDs seems like the optimal choice, though. |
I almost suggested that, but ended up deleting the comment draft :) It's still possible, even if less likely, to have false positives with |
@mvdan |
@DmitriyVTitov the library matches any URLs, not just HTTP or those handled by browsers. If gopls wants, they could filter the results to remove any URLs with a schema that a browser won't be able to open. See https://github.com/mvdan/xurls/blob/master/schemes.go. |
This seems like extremely low hanging fruit. Added 'help wanted', as I think this would be easy for an external contributor to pick up. However, I also think we should prioritize this for a post-1.18 release. |
@mvdan just to be clear: you're suggesting that we mutate the xurls.Schemes variable? I'm sure that would work, but it seems less than ideal. Could we perhaps add an API to xurls that allows passing the schemes? |
Perhaps I wasn't clear, I meant https://pkg.go.dev/mvdan.cc/xurls/v2#StrictMatchingScheme :) For example, |
Got it, thanks. I don't think you were unclear: you said "filter the results", which seems unambigious. I just misread it. I'll do that. |
FWIW this is precisely what I do in my project that uses |
Change https://go.dev/cl/393854 mentions this issue: |
For asking questions, see:
#vscode
channel in Gophers SlackBefore filing an issue, please review our troubleshooting guides
Please answer these questions before submitting your issue. Thanks!
What version of Go, VS Code & VS Code Go extension are you using?
Run
go version
to get version of Go from the VS Code integrated terminal.Run
gopls -v version
to get version of Gopls from the VS Code integrated terminal.Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Check your installed extensions to get the version of the VS Code Go extension
Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Tools
command.GOBIN: undefined
toolsGopath:
gopath: C:\Users\dtsp\YandexDisk\go
GOROOT: c:\go
PATH: C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Program Files\Graphviz 2.44.1\bin;C:\Go\bin;C:\Users\dtsp\AppData\Local\Microsoft\WindowsApps;C:\Users\dtsp\AppData\Roaming\npm;C:\Users\dtsp\go\bin;C:\Users\dtsp\YandexDisk\go\bin;C:\Users\dtsp\AppData\Local\GitHubDesktop\bin;c:\flutter\bin;C:\msys64\mingw64\bin;C:\Users\dtsp\AppData\Local\Microsoft\WindowsApps;C:\Users\dtsp\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\dtsp\go\bin
gopkgs: C:\Users\dtsp\YandexDisk\go\bin\gopkgs.exe installed
go-outline: C:\Users\dtsp\YandexDisk\go\bin\go-outline.exe installed
gotests: C:\Users\dtsp\YandexDisk\go\bin\gotests.exe installed
gomodifytags: C:\Users\dtsp\YandexDisk\go\bin\gomodifytags.exe installed
impl: C:\Users\dtsp\YandexDisk\go\bin\impl.exe installed
goplay: C:\Users\dtsp\YandexDisk\go\bin\goplay.exe installed
dlv: C:\Users\dtsp\YandexDisk\go\bin\dlv.exe installed
golint: C:\Users\dtsp\YandexDisk\go\bin\golint.exe installed
gopls: C:\Users\dtsp\YandexDisk\go\bin\gopls.exe installed
Share the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file.Share all the settings with the
go.
or["go"]
orgopls
prefixes.Describe the bug
I have SQL query:
Some of field names are treated as website names such as https://roles.name/ and so on.
Steps to reproduce the behavior:
Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
The text was updated successfully, but these errors were encountered: