I was wondering in Eclipse if it's possible to intercept when a user hits save or 'ctrl + s' via some sort of listener. What I want to do is determine when a file in a project changes and receive this notification before the file is actually compiled, so that I can update a property in the class. Afterwards, I would like the file to be compiled as per normal. Is this at all possible? Similar to the idea of a database trigger I suppose.
I would look at org.eclipse.jdt.core.compilationParticipant. From the description:
This extension point allows clients to participate in the compilation process by receiving notifications at various stages of build and reconcile, via a org.eclipse.jdt.core.compiler.CompilationParticipant.
Related
I want to be able to talk with Google Assistant, but connect the Actions project directly to an NLP service I already have running on my server. In other words, NOT use dialogflow.
All the following examples show how to do this.
With Rasa
https://blog.rasa.com/going-beyond-hey-google-building-a-rasa-powered-google-assistant/
With LUIS
https://www.grokkingandroid.com/using-the-actions-sdk/
https://dzone.com/articles/using-the-actions-sdk-for-google-assistant-develop
With Watson
https://www.youtube.com/watch?v=no0R0bSkHXc
They use the actions.intent.MAIN as the invocation and actions.intent.TEXT for all other utterances from the talker.
This is what I need. I don’t want to create a load of intents, with utterance phrases, inside the Action because I just want all the phrases spoken by the talker to be passed to my server, and for my NLP service to deal with them.
So I set up a new Action project, install the Actions CLI and then spend 3 days trying all possible combinations without success, because all these examples are using gactions cli 2.1.3 and Google have now moved on to gactions cli 3.1.0.
Not only have the commands changed, but so too has the file formats and structure.
It appears there is also a new Google Actions Console, and actions.intent.TEXT is no longer available.
My Action is webhook connected to my server, but I cannot figure out how to get the action.intent.TEXT included and working.
Everything I find, even here
Publishing Actions on google without Dialogflow
is pre version update and follows the same pattern.
Can anyone point to an up-to-date, v3.1.0, discussion, tutorial or example about how to send all talker phrases through to an NLP that isn’t dialogflow, or has Google closed that avenue?
Is it possible to somehow go back and use the 2.1 CLI either with the new Console or revert the console back. (I have both CLI versions, I can see how different their commands are)
Is it possible to go back and use 2.1?
There is no way to go back to AoG 2. You probably also don't want to do so - newer features aren't available with v2 and are only available with v3.
Can I use my own NLP with v3?
Yes, although it isn't as obvious, and there are some changes in semantics.
As an overview, what you'll need to do is:
Create a Type that can accept "Free form text". I usually call this type "Any".
In the console, it looks something like this:
Create a Custom Intent that has a single parameter of this Any Type and at least one phrase that captures everything for this parameter. (So you should add one training phrase, highlight the entire phrase, and set it for the parameter. Sometimes I also add additional phrases that includes words that I don't want to capture.) I usually call the Intent "matchAny" and the parameter "any".
In the console, it could be something like this:
Finally, you'll have a Scene that you transition to from the Main invocation. When it matches the "matchAny" Intent, it should call your webhook with a handler name. Your webhook will be called with the "any" parameter set with the user utterance. (Note that the JSON has also changed.
Again, the console might have it looking something like this:
That seems like a lot of work. Isn't there just some way to do all that from the command line?
Yes. You can do all of that in the configuration files that the CLI accesses and then upload it. (You can then also use the console to review the configuration, if necessary, to make sure they're configured as you expect. You can shift back and forth between them as appropriate.)
Google also has a github repository that contains most of the files pre-configured for this sort of setup.
You will need to update the configuration from the repository to handle the webhook correctly (it includes code to illustrate what is happening using the inline code editor) and to add your project ID.
I have following problem:
I created an app and the according oData in frontend system. Everything worked fine. Then I was taught, that this was not correct and I have to create the oData in backend system.
So I made this. I created just the same oData in backend system, created another service for the new oData in transaction /iwfnd/maint_service in frontend system, changed the data source in the manifest of my app, and everything seemed to work fine. To add the app to the launchpad I needed one (or two?) more services in transaction SICF (paths sap/bc/bsp/sap and sap/bc/ui5_ui5/sap). Those were generated automatically for my "frontend-oData". As those weren't generated automatically in frontend system for my new "backend-oData", I added them manually. This seemed to work as well. So I transported everything into quality system (the app from WebIDE to SAP was transported as "updating an already existing application").
And now my problem:
Yesterday after transporting my app ran perfectly in just updated version. Today I get an error in quality system, that says:
"No systemalias for service 'ZEXAMPLE_SRV_0001' and user 'USER1234' found" (I translated this error message from german). This error is new to me and I did not have this before. The settings for my "frontend-oData" were different ones (no systemalias & service processing mode = "Co-deployed only") and they were generated automatically.
Now for my "backend-oData" in development system there is the setting "Routing-based" and the correct systemalias is maintained and the app runs perfectly there. But in quality system there is no systemalias maintained. So I transported the systemalias from development system to quality system, but that didn't work, because the systemalias has to be a different one in quality system.
I tried to make exact the same settings in quality system for my "backend-oData" as the "frontend-oData" has, but then in /IWFND/ERROR_LOG I get the message "No service for namenspace /SAP/, Name ZEXAMPLE_SRV, Version 0001 found."
So can anyone tell me the secret which step I need to do, that everything runs correctly again? I am desperated by now.
Many thanks and best regards
In your dev system open transaction /IWFND/MAINT_SERVICE and select the service in the service catalogue.
You should see the system aliases in the bottom right:
Press on Customizing and in the following view switch to edit mode:
As soon as you are in edit mode, you can select Table view > Transport. It will ask you to select an existing transport or to create a new one.
Two buttons will appear in the customizing view. Add to transport and Remove from transport.
Select the system alias row from the table and press Add to transport.
Now press save!!! Otherwise the alias will not be part of the transport. It's only "put on hold" when you press "Add to transport". Press save!!!
Move the transport to your next system (and eventually into production) if you want to use your OData service in other systems.
We have a request to count the number of 'completion' events that have occurred from our LanguageServer in the vscode-python extension. (After a number of these completion events, we want to raise a popup and ask the user for some feedback).
I've not found a way to do this without asking for a change from the LanguageServer itself (have it raise an event that I can hook into). I am wondering if there is such a facility already available though, within VSCode?
I have found the BaseLanguageClient.onNotification from within the vscode-languageclient library. I am not entirely sure what method to hook into with this though, or even if there is an event relevant to my need.
Anyone have any tips for this?
You can inject middleware into your LanguageClient in order to capture events such as these. See here for an example:
https://github.com/Microsoft/vscode-go/blob/e0f8fc2540fecfe964807b97b1e4276c6b6c7a21/src/goMain.ts#L113
I've implemented a language server which provides some linting. The linter checks for required properties and issues 'missing property' errors. I would like to have corresponding 'insert missing property' quickfixes for these errors.
I think the general area of the LSP protocol meant for this is:
textDocument/codeAction
With this, the server could return a 'insert missing property' command for a 'missing property' diagnostic marker.
But how does the server implement the 'insert missing property' command itself?
Looking through the lsp spec, I can't find anything that lets the server register commands.
I did find some info about vscode apis for registering commands on the client side here: https://code.visualstudio.com/docs/extensionAPI/vscode-api
So I suppose I could register and implement the 'insert missing properties' on the client side, but...
The client side is only a 'dumb' wrapper delegating most work to the server. As such it doesn't really understand the document structure and isn't a very good place to implement transformations of the document that require understanding that structure.
It seems my best option is to add some 'custom' protocol to my language server so that I can implement the 'insert missing properties' command on the client side, but delegate the hard part of computing the edits for the quickfix back to the server.
Or... is there a better way?
Yes there is a better way which does not require any custom protocol extensions. These are roughly the steps:
First make sure that your vscode extension's package.json has an up-to-date language-server-client. Mine uses version 3.2.x. I also needed to update vscode engine version to 1.6.x. Here's an example package.json
Now we can use Version 3 (only a draft at the time of this writing, but already usable) of the language-server protocol. These are the interesting pieces:
textDocument/codeAction: implement this on the server-side to compute a list of commands that represent the quickfixes.
workspace/executeCommand: implement this in the server-side to execute the commands. It can make use of workspace/applyEdit to send a request to the client to perform changes to the documents in the workspace.
client/registerCapability: The server can call this with a ExecuteCommandRegistrationOptions object. This registers your server-side command(s) with the client, so that it knows to execute them via the workspace/executeCommand handler implemented in the previous step.
initialize: Alternatively to using client/registerCapability you can also register server-side commands by returning a WorkspaceCapabilities object with an appropriate setting for its executeCommandProvider attribute. This method is slightly less complex (but can only be used if you don't require registering/unregistering of commands dynamically).
See also this vscode issue ticket about the topic of implementing quickfixes.
Important note: Version 3.2.0 of the language-server client implementation has a bug, it uses the wrong name client/registerFeature instead of client/registerCapability so you may have to work around that until that bug is fixed. If you use the initialize method then you are not affected by this bug.
Has anyone successfully based an application off the WebIDE Fiori CRUD template? It doesn't seem to be able to handle errors in the batch OData request properly.
For example when you select an item in the master list and click EDIT to update it and I enter a value that I know will cause an error in the backend. The batch OData request is sent and the response is successful (overall) even though internally the update failed. You see a bad request 400 error in the console but the app doesn't react to it.
Using the ErrorHandler.js object you can easily code a message box to show a nice error message, however the app seems to get confused and always navigates to the top item in the list but the ODataModel still has pending changes so if you try to navigate it shows the data loss dialog.
Trying to debug it is very painful given the nature of the code with Promises inside promises inside promises and callbacks firing everywhere!!
Maybe there is a better example CRUD application to base your apps on?
Well.... Some more debugging and I've found that all of the weird issues occurring with the Fiori CRUD template are due to the model defaulting to auto refreshing after changes.
Which typically is a nice feature as the user does not have to hit the refresh button to see changes that have been made after adding a new entry or editing an object.
But this auto refresh on the model seems to play havoc with updates in batch mode.
Firstly, if the batch update is completely successful the app navigates to the first item in the master list - which is should not.
Secondly, when there is an error in the batch of sorts of weird shit happens.
So to fix this I just call oModel.setRefreshAfterChange(false) before the oModel.submitChanges() call (only when updating, not creating). The in the callback after the save is completed we reset auto refresh to true.
The crud app now works as expected and can correctly handle errors in the odata batch update without strange ui updates.
Jason,
but the error message they are providing is very simple, and does not support parsing error body like :
<code>005056A509B11ED199D882461C8C40FE</code><message xml:lang="en">The Data Services Request version '3.0' is not supported for the request payload.</message><
we have to do the code for parsing the errors then show in the message box