Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
External Editor
brettmcgin
Member Posts: 2 ✭
Hello,
Is it possible to open FeatureScripts in an external editor (vs code, sublime, etc)?
Is it possible to open FeatureScripts in an external editor (vs code, sublime, etc)?
2
Comments
-
There isn't an easy way of doing this.
Ideally, we want to make the experience editing FeatureScript inside a Feature Studio great. Feature Studios have some nice features that an offline editor would be missing, like autocomplete of all your imported libraries, versioning with your onshape documents, and automatic rebuilding of Part Studios when you commit.
If your favorite editor has specific features that you'd like Onshape Feature Studios to also support, please submit an improvement request!
0 -
If your really itching i can share my python script to push and pull the fs code to a local editor. As was stated, many of the goodies are not going to be on the local editor.Lou Gallo
Sr. Director of Product Definition. UX and Support1 -
I get that there are features that simply won't work in an external editor, and thanks for posting. I think people tend to get really use to editors and having the option to sync with a local file would be awesome, or even an api that we could hook into to make a good experience in Vs Code or similar tools.
I would love to check out the python code, much appreciated.2 -
I can understand wanting to make Feature Studio good on its own, but modern editors are whole software suites with a lot of features, so it seems like Feature Studio is always going to lag way behind dedicated editors in regards to actual editing features. A plugin could be made for VSCode, for example, that handles syntax highlighting, linting, std lib autocompletion, and even committing to the document on save. I understand that's a big undertaking, but I would love to raise that idea for reconsideration with Onshape product management.
Is there a way to make a feature request for something like this?3 -
kevin_o_toole_1 said:Ideally, we want to make the experience editing FeatureScript inside a Feature Studio great.The Onshape editor is disastrously slow for someone accustomed to a lightning-fast editor like Sublime Text. Some examples:
- Block commenting 100 lines takes 5 seconds, and block commenting 1000 lines means I should go get a coffee.
- I can see the lag between a keystroke and seeing it on the screen -- typing feels like I'm wading through a mucky bog.
I surmise that you are attempting to do work in the background (syntax checking, compiling, etc.) that is clogging the pipe.In addition, there are shortcuts that dramatically improve productivity. To me, the most painful is the lack of "multiselect" or "multicursor".
2 -
@George_Anderson I think something might be misconfigured for performance on your computer. I just tried copying an existing featurescript into a new feature studio (1,800 lines), find all & replacing comment starts & ends with spaces, and then block commenting various-sized sections out (700 lines, the whole thing, small chunk), and it took less than a second in all cases. I also don't have any noticeable lag between typing and seeing text. Could you post the results of https://cad.onshape.com/check ?
Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
@alnis is my personal account. @alnis_ptc is my official PTC account.0 -
@alnis_smidchens
Your browser is compatible with Onshape
User agentMozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:81.0) Gecko/20100101 Firefox/81.0PlatformMacOSBrowserFirefoxBrowser Version81.0Core WebGLFloat texturesAnisotropic texture filtering32-bit indicesHigh precision fragment shadersGL rendererIntel Iris Pro OpenGL EngineGL vendorIntel Inc.Your system is running an integrated GPU. If you have a dual-GPU system with a discrete chipset (NVIDIA or AMD) you can get better performance by forcing the browser to use the discrete GPU. See Graphics Performance Recommendations for more information.
Overall performance*Measured triangles per second130.1 millionMeasured lines per second41.3 million*For information on graphics performance, visit: Graphics Performance RecommendationsWebSocket connectionLocationSanta Cruz, United StatesOnshape server regionus-west-2Expected server regionus-west-2
0 -
I just confirmed that if I copy 1000+ lines of code into a completely empty document, then I can block comment 1000 lines in less than a second. Typing is still laggy.So this seems to confirm that Onshape is most likely doing something as you type code. Could be imports between different featurescript tabs, or running the code on part studios that use it. (I have about 5 part studios in the document as test cases for the featurescript -- they are not super heavy, I made them as lightweight as I could.)0
-
Very weird. The check seems all good. I'm not sure what to say, sorry! Is typing in any other web app slow? Google Docs, Slack, etc.Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
@alnis is my personal account. @alnis_ptc is my official PTC account.0 -
@George_Anderson
We're aware of the specific performance problem you mention (typing in large Feature Studios) and its fix is pending in a future release of Onshape. I'll update this post when it ships.1 -
+1 for vscode extension
3 -
kevin_o_toole_1 said:There isn't an easy way of doing this.
Ideally, we want to make the experience editing FeatureScript inside a Feature Studio great. Feature Studios have some nice features that an offline editor would be missing, like autocomplete of all your imported libraries, versioning with your onshape documents, and automatic rebuilding of Part Studios when you commit.
If your favorite editor has specific features that you'd like Onshape Feature Studios to also support, please submit an improvement request!I don't see an economical path that would make editing FeatureScript inside a Feature Studio "great". I can't imagine an experienced programmer working within the existing editor being anything other than incredibly frustrated. I'm not criticizing the existing effort as a bare-bones tool for adding very simple features, but there's no way you can (or should) compete with an editor that's had decades of person-years put in to addressing the needs of programmers.Just off the top of my head, the following features are missing:- split editor windows (opening in separate tabs is quite cumbersome)
- search/replace over multiple FeatureScript Files
- refactoring
- code folding
- edit key bindings
- bookmarking
- ability to implement new features inside the editor
These and at least a dozen other features are pretty much expected in even the most basic programmer's editor.Although syntax highlighting, autocomplete, and other features might be initially missing from an external editor, they'd be relatively easy to implement if we had even a rudimentary file/workspace api to interface with Onshape. FeatureScript has the advantage of being mostly like javascript, so it wouldn't be very hard to tweak existing javascript editors to accommodate FeatureScript. Most importantly, it's a task that the community could tackle - and we currently CAN'T change the built-in editor as far as I'm aware.1 -
As someone who's job is writing FeatureScript, I can agree that there are certainly some improvements that could be made. But, I don't believe an external editor is going to happen, its like an iceberg, Its a bigger challenge than you realize. There is already an API that lets you get and modify a FeatureScript, so you could today build an external editor. Likewise, all of the std code is public, so there exists the data required for autocomplete.
As a community, if we start pushing an external editor, we lose out on a lot of what makes FeatureScript great. FeatureScript is easy to pick up because there is nothing to install or configure. Its just there, inside of Onshape, ready to go. Its a very low barrier to entry. The built in editor also means its portable and benefits from the interactiveness of Onshape. I can load it up on any device and have it there. When I work with other developers and designers, we can jump into the same FeatureStudio and work through the code at the same time. Try that in an external editor. Consulting and code reviews are like 5x faster not having to deal with screen share.
Also, this thread is old and a bunch of the requests have been implemented. Part studios automatically rebuild, imported libraries show up in auto complete. The speed issues are pretty much gone, I've copy pasted 20,000+ lines of code without any issues.
Multistudio search/replace, refactoring, code folding, custom shortcuts, bookmarking, AND A BACK BUTTON (yes, if you ctrl-click a function, you cant go back) would be great improvements, and I think in time they'll get added. Create a thread in the improvements category and let people vote on it.
www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications7 -
Just to be clear, I'm not suggesting that Onshape create an external editor. I just want the ability to pull and push updates to FeatureScript files so that I can use a real editor when I have to make major changes. It looks like maybe that's possible without dissecting the js through the API, but I haven't found an example yet. I can't be the only one that would like to be able to do this. The features I mentioned in my previous post have been pretty much standard for a programmer's editor since at least the early 90s (with the possible exception of refactoring). I'm dating myself by saying this, but most of those features existed before a mouse was standard equipment.
0 -
Its just two endpoints:
https://cad.onshape.com/glassworks/explorer/#/FeatureStudio/getFeatureStudioContents
and
https://cad.onshape.com/glassworks/explorer/#/FeatureStudio/updateFeatureStudioContents
I read in a thread from years past that the featurescript IDE is based on a generic web IDE (ace), so the features are likely what came out of the box. Actually, code folding is supported: on windows highlight a section and do alt-L. Wish I knew that earlier...
www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications1 -
@Caden_Armstrong you might find this useful...
https://forum.onshape.com/discussion/12424/feature-studio-keyboard-shortcuts
Senior Director, Technical Services, EMEA0 -
Theoretically it should be possible to integrate browser based VS Code into Onshape. Amazon Web Services did this for example as a replacement of their former proprietary Lambda IDE.
1







