Is there any way to get context help intellisense about server API methods in Visual studio while editing javascript of cloudscript? I edited cloudscript in same c# unity project as client. Is any better, more comfortable way?
Is there any way to get context help intellisense about server API methods in Visual studio while editing javascript of cloudscript? I edited cloudscript in same c# unity project as client. Is any better, more comfortable way?
Is there any way to get context help intellisense about server API methods in Visual studio while editing javascript of cloudscript?
Yes
I edited cloudscript in same c# unity project as client. Is any better, more comfortable way?
I would certainly consider moving you Cloud Script source out into a separate project or folder. This would provide better separation of concerns when working on your project.
-----
Good news, there are tools and methods available that get you powerful tooling features when authoring Cloud Script. The method I am most familiar with and that has the most support from PlayFab is to author your Cloud Script source using TypeScript and then transpile it into JavaScript using the TypeScript compiler.
I am not familiar with getting a TypeScript development environment setup for Visual Studio, so I will post some helpful links and a process for getting started in Visual Studio Code.
-----
A mostly raw Copy/Paste of process I gave on the community slack today. It is a massive, poorly written dump of words, if you are confused on any part of it, feel free to post questions here or message me on the community slack.
Making the switch to TypeScript is not a hard process(certainly not harder than debugging untyped code). The hardest part of the switch is getting setup and fixing all the errors TypeScript catches when you start using it.
First off I recommend using Visual Studio Code. It is developed in TypeScript, backed by Microsoft, and has TS support built in.
Atom is a great editor but the primary TS plugin for it has been pretty much abandoned by its primary maintainer.
Unlike the atom plugin VSCode stops short of letting you use its built in TSC compiler, so you are going to need get a copy.
You will need node/npm for this, so if you already have them great if not, https://nodejs.org/en/
Now you ready to get the compiler.
http://www.typescriptlang.org/docs/tutorial.html
I recommend you just mess around with the compiler first before worrying about compiling your Cloud Script project.
Once your comfortable with just the compiler, if you have not gotten VSCode yet go ahead and get it. https://code.visualstudio.com/
You can then follow the instructions here https://code.visualstudio.com/Docs/languages/typescript to see some of the features VSCode offers as well as to setup the taskrunner.
If your feeling comfortable with all of the above, it is time to move onto porting your project. The first step to this is *not* changing all your .js -> .ts or getting the cloudscript.d.ts file. Instead first try and just get all your .js files running through TSC and compiling into a single main.js file
To do this your going to need to change outDir to outFile in your tsconfig.json. `"outFile": "../distr/main.js",` for example
Go ahead and look over that outFile to make sure you don't notice any major issues.
If all of the above is working, it is now time to "port your project"
Change all your files from .js => .ts and grab the cloudscript.d.ts from https://github.com/PlayFab/SdkTestingCloudScript/blob/master/src/typings/CloudScript.d.ts
Now try compiling the project, check out any of the type errors you will most likely start seeing. Once they are all cleaned up your read to keep on working as you were before the migration, however I highly recommend you start making some basic TS changes to your project as you continue to work on it.
This guide is awesome.
If you want a PlayFab Visual Studio CloudScript+TypeScript example project, look here:
https://github.com/PlayFab/SdkTestingCloudScript
We'll be improving it over the next week as well (Jan 30-Feb 3)
3 People are following this question.