Visual Studio Code addon to validate/syntax highlight Kodi Addons
#16
You might be able to extract some from our addon checker https://github.com/xbmc/addon-check
Reply
#17
Okay I'm studying addon-check and here are the features that it's implemented there

Check for invalid xml files:
    Here just try if can parse it with xml.etree.ElementTree.parse. If not can parse return an error

Check for invalid json files:
   Here again check if can parse with json.load. If not return an error

Check artwork:
   Here check the type of the image and if can open. Checking the type of the image we ensure that you need a icon and a fanart for your addon

Check if License exist

Check if legacy strings.xml exists and if exists encourage you to migrate to strings.po.something

Check the same for the language directory structure

Check for blacklisted strings

Check for files with whitelisted endings

Do you think I miss something? Maybe you can come with something else to add to the list?

Thank you for all, Razze
Reply
#18
Some of those are not demanded but best practices. For example, we recommend to have fanart, but we don't force you. But you need to have an icon as a regular addon.

On a side note, there is a tool to migrate from the old language paths to the new ones.

Most rules directly result from https://kodi.wiki/view/Add-on_rules not all of those might be interesting for a language server implementation but might be.
Reply
#19
Then...
"Make a Language Server to recognize imports from kodi API and imports from addon.xml" is a valid target for my proposal timeline? How much time do you need I need for this? One week?

Maybe another target is make a debug adapter to use the debugger on python files?
Reply
#20
I'm not sure if we can get the debugger to run, you would have to attach it to a running kodi instance showhow. Probably possible, but I got no idea how to do that.
Reply
#21
I'm especially interested in this work. I use VS Code for several languages. I have a few ideas for add-ons, but so far I've been too lazy to take the time to set up the dev env. As a user, this is what I want the process to be:
  • Open add-on folder in VS Code
  • Get Intellisense and Autocomplete for Kodi imports
  • Hit F5 to debug, and Kodi is either launched or focused, loaded to the add-on
  • Debugging works as normal, hitting breakpoints, showing exceptions, etc.

Another thing that would be great (but not necessary) would be a Command Palette (Ctrl+Shift+P) action to generate an add-on from a template, similar to the Yeoman generator. It could probably even run that generator behind the scenes. There is a great VS Code extension for getting started with Google Flutter that is a great example for what can be accomplished in VS Code.
Reply
#22
I really like the idea of an action to generate an addon from a template. And the debug idea is great but I need to investigate more to get an indication of how implement it. Can you help me with this?

Also I'm doing the proposal draft and you can see it in this Google Docs Link

If you want, you can make comments in order to help me to help you with this

Thank you!
Reply
#23
I can assist with turning the Yeoman generator into a VS Code command. I'm very familiar with Yeoman and the Node ecosystem in general. As for debugging, I'm not sure. VS Code has an official Python extension that provides language and debugging. Here are some official docs:

https://code.visualstudio.com/docs/languages/python
https://code.visualstudio.com/docs/python/debugging

I don't have much experience with Python, or how Kodi's Python interpreter works. From what I'm reading, it's possible that you just need to configure launch.json to attach to the right interpreter. I could be way off though. I don't know when I'll have time to test this. Can you try it out?
Reply
#24
Razze what do you think of this proposal?

Proposal

Grateful for your feedback
Reply
#25
If you can go into more detail, it's quiet short. Also include a timeline, when are you planning to do what etc.
Reply
#26
I added some things more Link to proposal

I'm having some troubles for Phase 2 of the timeline. I think i can make the command to generate the addon from a template but seems like i can achieve more in this 3 weeks. Do you have something more to make that I'm forgetting?

Thanks for your feeback
Reply
#27
Not sure if you changed stuff already. But to me, 3 weeks for the debugger alone seems to be quiet fast. Great if you could do that, but I would expect it to be a bit more difficult.
Another thing I started thinking about, is that kodi is not nessesarily running your addons code when you start it (or attach to). It might also run 100 of unrelated python scripts at the same time, so that's info/debug you don't want to see.
Reply
#28
Concretely what need more explaining? The benefits, summary, what will the project focus on, etc?
Reply
#29
Well I would think everything, as the thing I mentioned above about the debugger suggests, that you did not think enough about what you want to do, when you want to do and how you want to do it. It usually helps me, to write everything down and slice it into steps, then align those to the weeks. Then move around until it feels right. And be sure to add/remove stuff if it doesn't feel right.
Reply
#30
is this project stopped ?
There is some other project like this ?
it's a very good idea that would incredibly speed up the development of a kodi plugin
Reply

Logout Mark Read Team Forum Stats Members Help
Visual Studio Code addon to validate/syntax highlight Kodi Addons0