go/gopls/internal/regtest
Shoshin Nikita d0768c9130 internal/lsp/source/completion: suggest only valid package names
Before this change directory names were used "as is" for package completion.
It could lead to invalid suggestions (for example, 'package 1abc' or package 'ab-cd').

This change adds a check whether a directory name can be used in a package path.
If the directory name is invalid, only 'package main' will be suggested.
Otherwise, the directory name will be normalized and will be used as a package name.

Note: normalized directory names contain only lower case letters and digits.

Fixes golang/go#44680

Change-Id: I4b710f90d1723c512e29dc3c248a1e681f1cd37f
GitHub-Last-Rev: 8ae69f1c6fdf80831e5773bdb3507a8d51a4a0cf
GitHub-Pull-Request: golang/tools#310
Reviewed-on: https://go-review.googlesource.com/c/tools/+/313092
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Trust: Rebecca Stambler <rstambler@golang.org>
Trust: Peter Weinberger <pjw@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-27 19:53:45 +00:00
..
bench internal/lsp: move gopls/internal/regtest -> internal/lsp/regtest 2021-04-23 16:19:37 +00:00
codelens internal/lsp: support Check For Upgrades in vendor mode 2021-04-23 17:35:25 +00:00
completion internal/lsp/source/completion: suggest only valid package names 2021-04-27 19:53:45 +00:00
diagnostics internal/lsp: move gopls/internal/regtest -> internal/lsp/regtest 2021-04-23 16:19:37 +00:00
misc internal/lsp: add a command to start the debug server 2021-04-26 15:43:18 +00:00
modfile internal/lsp: move gopls/internal/regtest -> internal/lsp/regtest 2021-04-23 16:19:37 +00:00
watch internal/lsp: move gopls/internal/regtest -> internal/lsp/regtest 2021-04-23 16:19:37 +00:00
workspace internal/lsp: move gopls/internal/regtest -> internal/lsp/regtest 2021-04-23 16:19:37 +00:00