Kodi Community Forum
Visual Studio Code addon to validate/syntax highlight Kodi Addons - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+---- Forum: GSoC (https://forum.kodi.tv/forumdisplay.php?fid=299)
+----- Forum: GSOC 2018 (https://forum.kodi.tv/forumdisplay.php?fid=284)
+----- Thread: Visual Studio Code addon to validate/syntax highlight Kodi Addons (/showthread.php?tid=329448)

Pages: 1 2 3


Visual Studio Code addon to validate/syntax highlight Kodi Addons - bbuccianti - 2018-03-10

Hi! I'm Benjamin from Argentina and I'm interested in doing this project for the GSOC 2018. In the wiki you suggest that we can ask for more info in this forum and that what I'm doing here Big Grin. Glad to expand the idea and come with a useful project. Here go the questions of the Welcome and Read this first and sorry for my english isn't my first language but I think I'm explaining myself well. 

Tell us about the computer(s) and devices you have available for working on your SoC project?
  I have a hp elitebook with a i5 processor and 8gb of ram

When did you first start programming?
  Started programming around 3 years ago with some BASIC and VB6 on school

Are you a user of Kodi? When did you first start using it?
  I'm not currently a user of kodi only used it a couple of times to manage the movies from my bed with a smartphone

Have you contributed to other Open Source projects? If so, which projects and can we see some of your code?
  No, if I can make it this are going to be my first time contributing to a open source project

If you have not contributed to open source projects, do you have other code we can look at?
  I have little programs in my github account. Maybe the more interesting is one that recently I'm doing with VueJs framework

What sorts of programming projects have you done on your own time?
  Some webpages for clients

How much time do you have available, and how would you plan to use it?
  I can manage to get 35-40 hours every week to this project

Do you plan to have a job or study during the summer in conjunction with Summer of Code?
  I'm studying in the mornings but have winter holidays from 14/07 to 06/08


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - Razze - 2018-03-11

Hey nice to have you here! Smile

You would have to look into how to write an visual studio code language server. See this for guidance https://code.visualstudio.com/docs/extensions/overview

There has also be some discussion here.
https://github.com/xbmc/addon-check/issues/46

Biggest problem right now is that vscode only support javascript language server components right now. So we can't use any of the work we did for addon-check.
We could also think about forking from the python language extension, but that is quiet a big implementation already and might be hard to clean up.


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - Razze - 2018-03-11

It might be worth to ask on the vscode side of things for the progress on other languages for the language server. I'm not able to find an issue on their github about it.


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - Razze - 2018-03-11

Okay, it turns out that I misread some days ago. We can use whatever language we want, to implement the language server protocol.


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - bbuccianti - 2018-03-11

What are the differences between a kodi addon and a simple python file?


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - Razze - 2018-03-11

Well it's python 2 (going to be python 3 soonish), but most of the kodi specific libraries that your referencing can't be resolved by normal tools.
As they only exist on kodi runtime.
We also have some more files then only .py to make up an addon. There is addon.xml, settings.xml and language handling (which should be doable by .po addon). And that's just from the top of my head.


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - bbuccianti - 2018-03-11

Where I can get specifically details of the validate/syntax we need to add to the language server protocol?


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - Razze - 2018-03-12

As said the syntax is the same, it's mostly just imports that will fool you.
These imports for example "just exist" when you run kodi https://github.com/xbmc/repo-plugins/blob/krypton/plugin.video.rocketbeans/resources/lib/plugin.py#L9-L11

Other then that it's only some supporting files. Like addon.xml https://github.com/xbmc/repo-plugins/blob/krypton/plugin.video.rocketbeans/addon.xml
And settings.xml https://github.com/xbmc/repo-plugins/blob/krypton/plugin.video.rocketbeans/resources/settings.xml

I'm not 100% sure if a language server will address this, but what I'm trying to say is that we don't want a python only check. We need a customized python check in combination with checks for the other files included.


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - bbuccianti - 2018-03-12

Please sorry if I can't understand this I'm really struggling to get my proposal done. How can I get what we need to support to validate and what we need to support to syntax highlight in a Visual Studio Code extension? 

You mention the imports of a python file. What we need from the imports? We need to check for errors in the syntax? Maybe add suggestions?

Also you mention xml files. What do we need here? We need to validate something? Maybe add snippets?


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - Razze - 2018-03-12

Well I would recomment that you load some addons into vscode on your own and most of the problems should show up pretty soon.
Syntax should be fine, as long as you don't try to work with the kodi specific libraries, that's what I would like to fix. Suggestions included.

The xml files should be validated against a schema, depending on which kind of addon it is. We do have basic schemas, but they are not complete (read this please https://github.com/xbmc/addon-check/pull/35). Snippets might not be that useful, really depends.


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - Roman_V_M - 2018-03-12

(2018-03-11, 22:10)Razze Wrote: but most of the kodi specific libraries that your referencing can't be resolved by normal tools.
As they only exist on kodi runtime.

https://github.com/romanvm/Kodistubs  I admit that I may not always keep track of the most recent API changes, but any help is welcomed Smile


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - Razze - 2018-03-12

I'm aware of those, but I feel like we can make it easier and more welcoming to new comers.
A good first start out of scope of this topic, would be extending https://github.com/xbmc/generator-kodi-addon/issues/35

But it should really just work out of the box, that should at least be what we strive for.


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - bbuccianti - 2018-03-12

(2018-03-12, 17:27)Razze Wrote: Well I would recomment that you load some addons into vscode on your own and most of the problems should show up pretty soon.
Syntax should be fine, as long as you don't try to work with the kodi specific libraries, that's what I would like to fix. Suggestions included.

The xml files should be validated against a schema, depending on which kind of addon it is. We do have basic schemas, but they are not complete (read this please https://github.com/xbmc/addon-check/pull/35). Snippets might not be that useful, really depends.
 I load some plugins but can't see what are the problems. Can I open a thread in the forum for get feedback by real addon makers?


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - Razze - 2018-03-13

You sure can


RE: Visual Studio Code addon to validate/syntax highlight Kodi Addons - bbuccianti - 2018-03-13

The post in the addons forum isn't working. Have you any recommendation on how to gather the real requirements of the extension?


This forum uses Lukasz Tkacz MyBB addons.