Open alexeagle opened 5 years ago
+1 On Thu, 17 Jan 2019 at 20:54 Alex Eagle notifications@github.com wrote:
If my BUILD file uses ts_library but didn't have a load statement, I get
INFO: Invocation ID: fed413d4-6f15-4e1e-aab2-f026332cde62 ERROR: C:/users/alexeagle/projects/try_bazel/BUILD.bazel:1:1: name 'ts_library' is not defined (did you mean 'py_library'?) ERROR: error loading package '': Package '' contains errors
First, the last line here is spam. Second, it suggests py_library which is strange to me as a novice user: I don't have any Python and didn't configure Bazel to use python so why am I getting this? Angular users will be put off by the idea that Python is the preferred language in Bazel.
Ideally we should allow rules_typescript to contribute a helper, so that Bazel would suggest adding the correct load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bazelbuild/bazel/issues/7163, or mute the thread https://github.com/notifications/unsubscribe-auth/ABUIF25OliysWLwZuK_mOt_FD0tsU0dIks5vEMblgaJpZM4aGhls .
Any ideas for a good design here? (Bazel has no idea that ts_library even exists...)
@laurentlb why does it suggest 'py_library' in this case (and not say cc_library or some such)?
py_library
is arbitrary, cc_library
would be equally likely. Typo checker is just looking at other symbols that are defined. We could update the typo checker to skip symbols that don't even start with the same letter.
In my opinion, we want to have a mapping of symbols to label in each repository. This mapping would be useful for Buildifier (to automatically insert missing load statements), code completion in IDEs, as well as error messages.
Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.
This is still relevant.
Without any load
statement for build_bazel_rules_typescript
in any BUILD file, that repo won't be loaded in the first place and thus can't possibly register its rule names.
But Bzlmod could solve this: Since MODULE.bazel
files are always evaluated, rulesets could potentially register their rules and the corresponding load statements there. This information could be collected by a third-party module extension that doesn't have to be part of Bazel, but of course if we want Bazel error messages to contain information produced by it there needs to be some kind of special handling.
@Wyverald @meteorcloudy You might be interested in this and could also apply the modern labels to it.
Edit: @comius This would also become quite relevant when native rules are to be moved out of the Bazel core.
If my BUILD file uses
ts_library
but didn't have aload
statement, I getFirst, the last line here is spam. Second, it suggests
py_library
which is strange to me as a novice user: I don't have any Python and didn't configure Bazel to use python so why am I getting this? Angular users will be put off by the idea that Python is the preferred language in Bazel.Ideally we should allow rules_typescript to contribute a helper, so that Bazel would suggest adding the correct
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")