Comments (3)
By "hide" do you mean keep them out of autocomplete (would be easy)? Or, for the case of private variables, only allow them to autocomplete in the scope in which they are defined (a little difficult for basic functionality, really difficult for full functionality)?
Or should they be in autocomplete but show a warning when used?
If such variables do get used without autocomplete, would that be flagged as an error?
from stitch.
I think a good solution to start would be to hide variables from autocomplete that are marked as private via JSDocs or maybe prefixed with an underscore.
Adapting later on to provide more intelligent autocomplete would be a good idea.
Open to suggestions :)
from stitch.
This is tricky since I think it's pretty rare that you want something to be universally excluded from autocomplete. We probably need to break it down by case to figure out what kind of behavior would be useful.
Cases that come to mind:
- You may have functions defined in scripts that are only useful within that script, so you wouldn't want to see them everywhere else. But in that case it's probably better to refactor so that those things aren't global (e.g. as
static
s inside of other functions or constructors somewhere). - For libraries, you may have variables that you want to see while working on the library, but not when the library is used in the context of another project. But you probably want autocompletes for some of the stuff in the library. I'm not sure how you'd get the subset you want, especially since you'd be dependent on the library author to annotate things properly (or to follow a naming convention).
self
variables in objects that you only want to see when you're in the object's code (rather than when you reference the object in other files). E.g. if I've got an objectobj_a
with an internal function_on_step()
, I'd want to be able to see that function elsewhere in the object code but not when I'm dotting into an instance of that object. That would be pretty straight-forward to implement -- we'd just skip_on_step()
unless the current file is one ofobj_a
's event files. But if I do decide to reference that function somewhere else, I'd probably want a warning instead of an error.self
variables in struct literals and constructors are similar to objects, and I can see wanting to limit their visibility to within the literal's definition or the constructor body. That's a little trickier than just checking what file we're in, but probably doable. As with objects, I imagine we'd want to see a warning when these are used outside of their "private" scope, but still have them work there.- Local variable already have limited visibility, so I don't see a use-case for hidden local variables.
At least for the cases I can think of, I can see a case for Typescript-style protected
variables that wouldn't bee too hard to implement. private
(also not accessible to constructors/objects inheriting from the parent with that variable) may be doable but definitely adds a layer of complexity.
I can see starting with implementing a @protected
JSDoc for self variables that works as described above. Having a configuration option to allow specifying a prefix/pattern to treat matching variables as protected
even without the JSDoc wouldn't be a big deal once the functionality was in place.
Does that cover the kind of thing you're imagining? Do you have any specific cases of things you want to hide? If so, where do you want them visible versus invisible, and why?
from stitch.
Related Issues (20)
- Add Audio imports to Stitch for VSCode HOT 1
- Investigate importing SVG images as sprites HOT 2
- `guideColour` in Sprite `.yy` files is not properly formatted HOT 1
- Add external drag-drop of sound assets HOT 1
- looks like a global but is not declared anywhere HOT 3
- Uninformative error: `StitchParserError: Cannot replace existing member with new member`
- The new yyp format has all of the resources sorted alphabetically. Stitch should also format things that way. HOT 1
- Add a "runner" panel in Stitch VSCode HOT 1
- Runner Panel: Add customizable color-coding HOT 1
- Renaming a script resource causes the project to be unable to run.
- Cannot convert 1E-10 to a Bigint HOT 1
- Add "New Project" command HOT 1
- Symbol searcher: can we go directly to sounds?
- Create Room assets from VSCode
- Add object instances to a room via VSCode HOT 1
- Audio assets cannot be added to new folders HOT 2
- "Set Sprite" dropdown menu in the Object Inspector tab doesn't set the sprite.
- Renaming an object doesn't rename it in the rooms that object is placed in. HOT 1
- Can't create collision events on objects from VS Code, adding them from Game Maker makes name of event invisible in VS Code HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stitch.