Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[Visual Studio Code] (TypeScript) Intellisense support for your projects

Hey there,


Just wanted to share this 'project', maybe someone will find it useful for their development needs.
I certainly do like having some sort of Intellisense when developing.

I wrote this with Visual Studio Code in mind as editor. It's not the next greatest thing, but I do find it useful. The setup might take some time, but it's worth it Smiley Very Happy

 

Have a look:
https://github.com/Woyken/Mocked-Fitbit-SDK-Interfaces


Any support/ideas are welcome.

Best Answer
7 REPLIES 7

Thanks. I very much want to take advantage the capabilities of VSC so will look into this as I get time.

 

I want to encourage Fitbit to provide native support for VSC including the ability to run apps from there. I appreciate the work done for the current Fitbit Studio but having Intellisense and other capabilities would be invaluable.

Best Answer

Thanks for this, makes life a bit easier. I'd love to be able to deploy/build from within VSC as well. I've looked at Fitbit Studio and it seems all of this functionality (including uploading files) is built fully on top of a REST API. It should be quite easy to implement some of these things in a VSC extension. Might look into that if I have the time (if).

Best Answer

Awesome! Glad to hear it helps, I can't live anymore without it Smiley Very Happy.

And yeah, I had these thoughts about integrating in some 'hacky' way directly into API too... Although time is not my friend these days too Smiley Sad.

Best Answer
0 Votes

Hi Woyken - firstly, thanks for sharing this ... it must have taken a while to put all this together so really kind of you to share so freely 🙂

 

So, I've got this working for me now using VS Code by adding following to my tsconfig.json which is in the top-level directory.

  "include" : [
    "./**/*.ts",
    "./Mocked-Fitbit-SDK-Interfaces/**/*.d.ts"
  ]

I also needed to add following to the clock.d.ts declarations.

export = clock;

Everything works fine in VSC but when I move the project into Studio it won't build as it complains it can't find some of the classes referenced in my project files (which it obviously can find when it's in VSC).

 

Any obvious suggestions where I'm going wrong?

 

Thanks

Best Answer
0 Votes

Hey! Thanks for using this :). I'm exited that people are finding it useful.

As for your problem, I would guess that you are using some interfaces as types, such as "EventTarget" or "SensorOptions" or what ever. There is this problem, these types are not exposed by SDK itself, although they are clearly referenced in documentation, but I guess since it's mainly based on JS they won't be exposed right now. Anyway, to fix this you would have to add something like this in your "production" code:

declare type SensorOptions = any;

 

Best Answer

That's got it. Thanks. 🙂

 

(I'm probably being lazy here and should find out what the actual type is Smiley Embarassed

 

Best Answer
0 Votes

Just to close this out - I've added a file called DeclIfTypes.ts at the top level then in the copy on Studio, for the files that complain, the files contains a series of "declare type XXX = any;" per WauloK's suggestion. The copy on my local machine is empty. Then, at the top of each .ts that references an interface I've put the following line '/// <reference path="../DeclIfTypes.ts"/>'. This way I get the type checking while I'm in VSC and it builds cleanly in Studio - bit of a hack but seems to work!

 

Thanks again.

Best Answer
0 Votes