How can I make Visual Studio Code to work with require("moduleName")
e
eyal medina
started a topic
about 5 years ago
I would like to try working on the cloud code on VSC and take advantage of the abilities it has.
But it won't recognize the require("moduleName").
Is there a way to fix that?
Best Answer
C
Customer Support
said
about 5 years ago
Hey Baris,
You can do the following inside of an Atom Text Editor for AutoComplete:
In Atom install the 'atom-ternjs' plugin. You can then go to Packages -> Atom TernJS -> Configure Project. When that config is saved it will create a '.tern-project' file. I have attached the tern definitions, save them into the same location. Edit the .tern-project to add 'autocomplete.gs.json' to the libs section. Then Packages -> Atom TernJS -> Restart server
This allow you to write cloud code with AutoComplete locally.
@Daniel, yes cloud code can use that setting, it is currently undocumented whilst it is mentioned here in relation to real time scripts and modules..
How do I make the autocomplete work with modules?...
e
eyal medina
said
about 5 years ago
Patrick?
e
eyal medina
said
about 5 years ago
Thanks, The GameSparks API autocomplete works, But I can't get autocomplete for modules by using the require("moduleName").
I've added the plugins SpectateModeManager commonjs and requirejs and modules and still nothing, I guess I need to set some .tern-project settings for it right? what exactly do I need to do now?
Customer Support
said
about 5 years ago
Answer
Hey Baris,
You can do the following inside of an Atom Text Editor for AutoComplete:
In Atom install the 'atom-ternjs' plugin. You can then go to Packages -> Atom TernJS -> Configure Project. When that config is saved it will create a '.tern-project' file. I have attached the tern definitions, save them into the same location. Edit the .tern-project to add 'autocomplete.gs.json' to the libs section. Then Packages -> Atom TernJS -> Restart server
This allow you to write cloud code with AutoComplete locally.
@Daniel, yes cloud code can use that setting, it is currently undocumented whilst it is mentioned here in relation to real time scripts and modules..
Patrick, does this mean Cloud Code supports CommonJS style require with that option set? Is this documented somewhere?
B
Baris Tumerkan
said
about 5 years ago
This is probably a very long shot, but is there a way to have Visual Studio recognise/auto-complete GameSparks Cloud Code API classes and functions?
Customer Support
said
about 5 years ago
Hi Eyal,
Could you try using the commonjs style require here?
To change the require setting (this is the only current setting) you can place require = commonjs; at the top of your script and then use that style of module acquisition.
To call the module itself as well as inherent functions you will do the following:
eyal medina
I would like to try working on the cloud code on VSC and take advantage of the abilities it has.
But it won't recognize the require("moduleName").
Is there a way to fix that?
Hey Baris,
- Oldest First
- Popular
- Newest First
Sorted by Newest Firsteyal medina
How do I make the autocomplete work with modules?...
eyal medina
Patrick?
eyal medina
Thanks, The GameSparks API autocomplete works, But I can't get autocomplete for modules by using the require("moduleName").
I've added the plugins SpectateModeManager commonjs and requirejs and modules and still nothing, I guess I need to set some .tern-project settings for it right? what exactly do I need to do now?
Customer Support
Hey Baris,
Daniel Borgmann
Patrick, does this mean Cloud Code supports CommonJS style require with that option set? Is this documented somewhere?
Baris Tumerkan
This is probably a very long shot, but is there a way to have Visual Studio recognise/auto-complete GameSparks Cloud Code API classes and functions?
Customer Support
Hi Eyal,
Could you try using the commonjs style require here?
To change the require setting (this is the only current setting) you can place require = commonjs; at the top of your script and then use that style of module acquisition.
To call the module itself as well as inherent functions you will do the following:
var theFirstModule = require("ModuleShortCode");
theFirstModule.HelloWorld();
We call functions via dot notation.
Hope this helps, Patrick.
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics