Repository navigation
feat: Export lsp servers - #278
Conversation
|
Today we have just one templates json files which is a bad idea. I think we should delete this files and create a template json file per server hosted on each ls folder. I speak about templates loaded from classpath. Your export/import should working with the same structure than the existent loading of templates from classpath |
No it doesnt exist. You will need to implements a serializer. One idea that I suggest is to remove the existing json files which stores all templates and move the template in each ls folder. The idea is to provide a load method from the template manager which expects a dir folder to load. You could use this load method to load templates from classpath like today and load templates from a given zip. The manager should provide a save method which have a list of templates and save each template in a given zip entry which will store templzte.json settings.json etc. Your export action should loop for selected ls définition a list of instance of template instance loaded from ls definition |
As I have try to explain you the README.md should be stored per ls template |
|
Gotcha, it'll take a while to get all of this together. Should this create both, a file type and a file name pattern? "fileType": {
"name": "Rust",
"patterns": [
"*.rs"
]
},Just having a name creates a file type mapping and just having pattern creates a file name pattern. Currently this only creates a file name pattern. |
5abd8ea to
b8f0968
Compare
|
Still a work in progress, requires cleanup and tests. Separated the template json to folders. Added dir selector, and loading template from a directory works and is mapped correctly. |
ad6bff0 to
64b0245
Compare
@angelozerr Is this fine as is or should we get the same json back when doing import and export? |
Sorry I don't understand what you mean, import and export should use the same JSOn structure, right? |
|
I think that answers my question 👍 So, right now it doesn't handle the case correctly when the template.json has both "name" and "patterns" elements. I'll check this out |
|
If your question is about the structure of the file type, my idea was to save the same information than IJ FileType With the file type ui settings you can create a file type with a name which is required and after that you can add some association patterns. In LSP4IJ file patterns is used at first and name after that. |
|
@MituuZ your PR looks awesome, I review it very quickly. Whe you think it is ready please tell me and I will play with your PR. Once your code will be finished, I think it should be good to write a documentation about this great feature at the end of https://github.com/redhat-developer/lsp4ij/blob/main/docs/UserDefinedLanguageServer.md#using-template |
|
My bad. Forgot to update the tests after throwing an error from the import |
When you need great idea for feature, ask to @fbricon :) |
|
@MituuZ why there is a new button without label (on right bottom): It seems that it does the same thing than the round icon help, is it possible to remove this button? |
|
@MituuZ we have the intention to create a release this weekend. It would be nice if we could embed your great PR. If you have no time to work on it (fix my suggestions for the documentation) please tell me. |
|
Hadn't even noticed that button. I'll check it out, I'm sure it can be removed. I'll try to finish these changes today, but at the latest tomorrow. I'm also able to work on Friday if any tweaking is required, so I'm pretty positive this will be ready on time. |
Withour your PR, we have not this button:
Great! But no stress please! If you have no time to work on the documentation, we could merge it and you could (or me) do that after the release, but we need to remove this strange button.
Thanks so much for your great work. |
|
Had to specify the actions which get their own button. When I implemented the help action it created that empty button by default. I just didn't notice it showing up. Happy to help :) I'll be doing some studying during the summer and probably dabbling in some other projects too, but as #279 is low prio I could work on that when I have the time |
|
@MituuZ thanks so much to have improved the doc. IMHO I think we should have relation between Using @fbricon what do you think about that? The usecase is:
The documentation doesn't show this usecase and it is hard to know which folder you need to select to import template. So I think in the custom template section, you should show a new screenshot with the unzipped exported file which select the proper folder. You could say a sentence like, "You can load from a custom template that you have exported (and set a link to the export section). If you have no time to do that, please tell me, wemerge your PR and I will do the changes. |
Thanks so much! Your contribution provides a very professional features.
It is a kind issue which provide a more professional behavior of the plugin, it is low prio because I need to work on another features, but if you can work on it, it should be very cool. |
|
I agree with linking the export/import docs and renaming the "Add new template" would make it clearer. I think I can push new changes this evening. |
|
Tried to make it a bit clearer and have a links to both directions and also prop up the directory structure required. Also moved the selection string copy to the bundle |
|
Thanks so much @MituuZ for your great contribution! I merge your PR because the main feature works pretty well. We could improve it in another PR like:
|
…plate with instructions (#2046) Part of #1935. A template can have a `README.md`, its instructions, which the help button of the New Language Server dialog opens in `ShowInstructionDialog`, as UserDefinedLanguageServer.md says. Since fd5aed9 (#278), the dialog's `createActions()` returns OK and Cancel only, so the dialog had no help button, and the instructions couldn't be opened. Before that, the button showed for every template, and did nothing for one without a README. The dialog has the help button again, and shows it only while its template has instructions. `getHelpAction()` returns one action, which `createActions()` and `DialogWrapper` find again, and the dialog keeps the button that `DialogWrapper` creates for it on its left. In an IDE without context help, `DialogWrapper` removes help buttons, as for every other dialog. Not here: the choice of #1935 between the README of a template and its docs page. Options B, C and D keep the README, at least for a custom template, which has no docs page, and so this button; option A would remove both. Test: `NewLanguageServerDialogInstructionsTest` loads a template with a README into the dialog, and one without, and checks that the help button shows for the first only. It and `NewLanguageServerDialogTransportTest` pass (17 tests).



Fixes #213
This is still a rough draft.
Created handling for exporting a single zip that contains a folder for each exported language server.
Would there be existing ways to get the json representations for the wanted files (template.json file + settings.json + initializationOptions.json)?
The gson output was not correct so I'm guessing the json creation needs to be implemented in a more manual way.
Would the README be a static file on the root of the zip file or should each ls have its own?
There wasn't handling for selecting multiple language servers so I split the handling quick and dirty. I guess deleting multiple servers at once could be implemented later.