-
Notifications
You must be signed in to change notification settings - Fork 26
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
Parsing csharp files does not recognize the language #297
Comments
This is a known problem in bblfsh:
We use supported languages API to provide meaningful error to the user. So the question is: do we want to implement workaround inside engine specially for C#? //cc @creachadair maybe you have some ETA for the proper fix on bblfsh side? |
My understanding was that the fix from bblfsh/bblfshd#251 was supposed to address this without requiring a change to Engine. To really fix this we will need a solution for aliasing, for which we don't have a timeline yet (@bzz has started an RFC for the question, but we have had higher-priority work so far). Is the above workaround not working for you? |
it does not. We use enry + bblfsh supported languages api to check that bblfsh is able to parse a file. This api currently doesn't return |
I see. So is the issue not that you're unable to get a parse for the file, but that the list of languages doesn't match the string on the Engine side so that Engine doesn't even ask? |
@creachadair yes jfyi workaround from above also doesn't solve the issue for |
I added this as a known issue to the release notes. |
I would propose to return this issue to backlog and wait for the fix from LA team instead of implementing work around on our side due to:
@carlosms wdyt? |
Makes sense, let's wait for a proper fix, I don't think there is any rush. |
It also fails for cpp (c++ is not supported) and bash (shell is not supported). |
It seems like C# is then not supported in any way other than language detection for the Engine. |
just for the record:
|
Dropping mentions is a safe choice. But note that the issue is in the language detection, not the functionality: Specifically the detection labels a C# file as "C#" which doesn't match Babelfish "csharp" and thus the file never makes it to the parsing step. So this is a real bug, and needs a real fix, but the core functionality is solid. So I think we can demo the feature safely, modulo the need to work around that issue. Unfortunately, while the solution isn't difficult, it touches a bunch of plumbing, so it isn't as easy as patching one layer. |
I've tested it a bit more and this works with 0.11.0:
So the real limitation is that you can't rely on automatic language detection, but you can still get UAST if you set the language manually (like @smacker said for the SQL queries). I will add this information to the known issues section of the release notes. I've also tried a quick workaround, in case we think it's worth to release engine again to fix this issue on our side until it is handled by bblfshd. If we remove this check, these 3 cases would work:
|
why can't we check if one of the aliases of the required language is one of the exposed by I mean:
Doing so, the filter will be still there, but working properly. |
As a workaround, yes that makes sense. Now the question is if we want to do a workaround, or just wait for the proper handling of aliases by bblfshd. |
Sorry, I missed something... I don't see why is it a problem on $ docker run --rm -d --name bblfshd --privileged -p 9999:9432 bblfsh/bblfshd:v2.11.8-drivers And then I asked for the uast of a $ bblfsh-cli example.cs
$ bblfsh-cli -l csharp example.cs
$ bblfsh-cli -l c# example.cs all of them worked. It also worked for $ bblfsh-cli example.cpp
$ bblfsh-cli -l c++ example.cpp
$ bblfsh-cli -l cpp example.cpp 🤔 not for When I tried asking about a non existent driver language, it properly failed:
|
So my question is: Does the filter makes sense in source{d} Engine?
|
sorry for butting in, but just for the context - as noted in bblfsh/bblfshd#263 so far ETA for proper aliases in bblfsh is Q22019. Meanwhile @dpordomingo suggestion https://github.com/src-d/engine/issues/297#issuecomment-473219312 on applying public enry API I would argue that this is different from what has been discussed in this thread before - it's not a workaround specific for C# and it should be working the same way and not require a change later, after introduction of proper aliases support on bblfsh side. |
We didn't have this check on the installed drivers, then we added it after the discussion on src-d/sourced-ce#162, creating src-d/sourced-ce#163 & src-d/sourced-ce#186. |
From the user's perspective, it'd be nice if we can avoid doing extra work for queries we know can't succeed. Once we have sorted out the mapping correctly, I think that's a reasonable tactic. But early filtering does force a coupling between the two APIs that—in retrospect—I suppose we didn't think through clearly enough. In the meantime: I'd like to make sure the user gets an "understandable" result even if we have to do a little extra work (e.g., attempt to parse a file that a human might know won't work). The question for the UI, though, is how to tell the difference between "this failed because I couldn't find a driver for it" (which is what the pre-filter is a proxy for) and "this failed because the driver reported an error". I should know but do not: Do we already use canonical error codes to distinguish cases like this, which could inform the UI how to give feedback to the user when a parse fails? |
Workaround from v0.12 release notes:
|
discovered at https://github.com/src-d/empathy-sessions/issues/37#issuecomment-470045137
Running parse over a
.cs
file is not workingWorkaround
Until this is fixed,
csharp
needs to be passed explicitly to bblfshd. For example:The text was updated successfully, but these errors were encountered: