What is the correct way to add an option to the VSCode Settings Menu (editing VSCode's source) - visual-studio-code

(not sure if I asked this earlier somewhere, but I can't find it)
Earlier I found out how to create a usable entry on the VSCode settings menu (also usable in settings.json) by editing these VSCode source files:
vscode/src/vs/editor/common/config/editorOptions.ts
Adding a variable in export interface IEditorOptions.
Adding an enum in export const enum EditorOption.
Adding an item in export const EditorOptions.
vscode/src/vs/editor/common/standalone/standaloneEnums.ts
Adding an enum to export enum EditorOption.
I don't know if that's the correct way, I just copied other options.
I hadn't yet figured out how to access the new entry's value from the function I wanted to use it in (I had already implemented the functionality, just without the option).
I then got sidetracked and forgot about this.
Now when I try to build it I'm getting an error (it builds fine without the changes).
running yarn --cwd <mydir> run gulp vscode-linux-x64
gives Error: monaco.d.ts is no longer up to date. Please run gulp watch and commit the new file.
I'm not sure exactly how I'm supposed to run gulp watch here. I don't know anything about yarn or gulp (I'm just using the VSCode contributor instructions), and running yarn --cwd <mydir> run gulp watch doesn't fix the problem.
It sounds like vscode/src/vs/monaco.d.ts being read by the build process before being written/updated, because its timestamp changes. I'm not sure if that's my fault and/or if it's a red herring.
Does anyone know what I should be doing here? Has anyone here modified the settings menu?
Is there any documentation out there for modifying the settings menu? (I had a look, didn't find anything).

Related

command not found: flow

I followed the Flow installation guide for npm & babel and when I get to the second stage where you flow init I keep getting the error message zsh command not found: flow. I installed flow into my project (a branch of my Gatsby blog) for testing/debugging purposes. It is not installed globally, which is what the Flow docs state is the best practice:
Flow works best when installed per-project with explicit versioning rather than globally.
I have been having a similar issue with Lume that returns zsh command not found: lume
If I enter echo $PATH
The colon delimited list should have user/local/.deno/bin:$PATH but it is not there. If I add it by running:
export PATH="/Users/yourUserName/.deno/bin:$PATH"
Than I am able to run lume commands. However, when I try to run lume commands the next day I have to go through the whole process once more as the error crops up again...
My question here today is regarding the Flow error and getting it sorted. I only mention the Lume error because it makes me fairly certain something is messed up in $Path or my Zsh config. I am just not sure what. The only caveat to that hunch though is that Deno is a global install, whereas Flow is installed directly into my project...
So, maybe the two errors while the same syntax are totally separate?
Thank you in advance for any guidance/suggestions. Cheers!
I came across this video from 2017 no less and the host had issues with flow not working within the project and so he installed it globally. I gave it a shot and the flow error zsh command not found: flow has been resolved...

I could link the package with my project using 'npm-link'. But, Some how in the browser, the changes are not reflecting properly

I have a component library [design-system]. I want to use that library in another project.
I did run npm-link in 'design-system' and npm link design-system in the project.
First, the link didn't work, after I deleted package-lock.json and did npm i. I could see, my component refers to the design system's dist index path. Even If I change anything in the design system and build it. It is reflecting immediately in the project. I can see the design-system's code in VS Code IDE.
But, when we run the program, the changes are not reflecting in the UI.
For example,
I commented on the console.log code in design-system
even I can see this code in the package by clicking 'Go to Definition'. But in the browser, the code is not updated.
I cleared 'Application cache' and tried again. I don't know what I am missing. Please help me with this.
Thanks!
you need to run the build in watch mode for your design-system library. Now for each change, the library will build and the bundle will update hence you will see the changes reflecting.
Alternatively, for development purposes, you can do something like
"design-system": "file:../relative-path-from-pkg-json"
instead of npm-link. still, if you can target the non-build version of your library. it may or may-not work deponding on your build tooling.
Or you can get real fancy and try Nx Monorepo approach which will take care of everything about tooling. while you can focus on your development.

Full Rust setup in VSCode/Atom Issue

This is a long post, sorry.
I have been trying to start a project, using Rust, but ran into a problem: it just does not work correctly on Linux in VSCode/Atom.
Wasted 3 days, searching online, trying different tutorials/videos - nothing worked + most of the material is from 2017. I have tried Matrix chat, but no one knew what to do. Git too has no solution as people keep suggesting very random things, like "change this variable in toml file to something else, and back again"
Git: https://github.com/rust-lang/rls-vscode/issues/513
I installed (and re-installed rust many times in the last 3 days), and it works just fine from the terminal, but not in the Editor.
Two Issues:
Editors don't see any crates, so you can't run your code from the editor.
Autocomplete does not work (only works on std, not on extra crates you add).
What I did (out of many other things):
install Rust (on Manjaro and Debian computers): curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Tried stable, beta, nightly (for racer)
Just did a clean install again:
stable installed - rustc 1.40.0 (73528e339 2019-12-16)
Rust is installed now. Great!
Installed Rust (rls) rust-lang.rust extension in VSCode (and rust in Atom)
Created a new project: cargo new test_proj and added new rand = "0.6" to [dependencies] and used cargo build. It did build rand
Added "rust-client.enableMultiProjectSetup": true to the settings file to avoid a warning: A Cargo.toml file must be at the root of the workspace in order to support all features. Alternatively set rust-client.enableMultiProjectSetup=true in settings. by Rust (rls)
I also install 'code runner' extension that I use with Python, C++, and Java, to run the code from within the editor.
So now I have just the main func and it runs just fine from the editor:
Now I add rand and it seems to work, and does SOME auto-completion...
But now it stops working:
OK, I will finish the code and try running it, And now we can't run it anymore as the crate is missing:
OK, let's try Ctrl + Shift + B and try cargo build:
For some odd reason, it is looking in /media/Work/Work/rust_code and not in /media/Work/Work/rust_code/test_proj/
One last thing: let's try running in the terminal:
So it does work just fine.
Sorry for the long post, but I have wasted 3 days now and it still can't get it up and running. Did anyone manage to set this up at all?
It has to be Atom or VSCode as I have all of the other languages/projects setup there + VSCode is listed on the official Rust website, so I presume it should work.
Basically, out of two editors (VSCode and Atom), that have Debugging capabilities, unlike Intellij Rust, both don't work for me and I just can't code in Rust as tools are literally broken/not mature enough for productive work. Please let me know if I am wrong and it is just a case of one little flag, that everyone forgets to mention, is missing in some config.
Short Version
Assuming I understand the issue correctly. Then the various build issues boil down to different ways you're trying to build the project, and attempting to do so in different directories.
TL;DR: The directory you have open in VSCode is the rust_code directory. Close it and instead open rust_code/test_proj. Now the Rust: cargo build (or Rust: cargo run) should work.
Long Version
Editors don't see any crates, so you can't run your code from the editor.
The Rust: cargo build task isn't working, because the directory you have open isn't a "Rust project" (Cargo package), it's a directory containing another directory, which is a Rust project.
Looking at your screenshot shows this, look at how the top line says rust_code/test_proj:
When you execute the task, Cargo is complaining that rust_code/Cargo.toml doesn't exist, which is true since it's located in rust_code/test_proj/Cargo.toml
If you look at the output of this screenshot, you can see that is the case:
Here you're executing cargo run manually. But the important difference is that you're inside the rust_code/test_proj directory.
Lastly simply executing rustc main.rs is failing since you aren't passing the arguments needed. So rustc doesn't know anything about your dependencies.
Try executing cargo build -v then you can see all the arguments that Cargo is passing to rustc.
Autocomplete does not work (only works on std, not on extra crates you add).
Try and open a directory that contains a Cargo.toml, then code completion should work for dependencies. If I don't, then I get the following notification, and code completion only works for the standard library as you said. That being said, RLS is weird sometimes.
If I had to guess, then I think RLS compiles the code, and at some stage extracts the needed information. Thus if the code doesn't compile, then code completion could be affected. But this is 100% an educated guess.
Alternatively, I have heard praise about using IntelliJ + the Rust plugin, but I haven't used it myself yet.
I have figured out one part: problems with running your code from within the VSCode. I had to modify default code-runner command for rust:
Original command:
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
Changed to:
"rust": "if [ $(basename $dir) = 'examples' ]; then cargo run --example $fileNameWithoutExt; else cargo run; fi",
And now it works, and I can run my code quickly.
Part 2: Autocomplete still is very very bad, unfortunately. I am using RLS. there is this thing racer. Is it a better choice?
Alternatively, I have heard praise about using IntelliJ + the Rust
plugin, but I haven't used it myself yet.
As I mentioned in my previous post, IntelliJ, free edition does not have a debugger from what I can see. I need it.
I am wondering how people get a good autocomplete from Rust?

Why can I not compile TypeScript anymore?

I'm doing some web development and I did a commit & sync via GitHub's Mac GUI, then I installed some Mac updates that required a restart (I don't know what the updates were). When I opened my project in PHPStorm again, I found this error when I tried compiling my TypeScript:
/usr/local/bin/tsc
env: node: No such file or directory
I know the compilation was working before. My web application had no issues. This question deals specifically with me being able to do this yesterday, with no changes to the FileWatcher configuration.
I have my TypeScript Compiler in usr/local/bin/tsc (which I have checked as a valid path to a typescript compiler alias). When I click on the alias, It opens a terminal window and runs typescript, so I know it's there. PHPStorm also complains if I try to change the file path, saying I must pick a valid executable.
I modified my Environment Variables on the advice of Dan Clark's site but that hasn't changed anything. I don't have the reputation to upload a photo of my File Watchers Dialog.
Does anyone know why I am getting this error, and how it can be fixed? I mention GitHub because that's the last thing I did before things stopped working: a commit & sync, then a restart to install some Mac updates.
Both which node and which tsc point in the right direction. Just tsc also works.
My solution was to use the directory of the actual TypeScript compiler at /usr/local/lib/node_modules/typescript/bin/tsc
instead of
/usr/local/bin/tsc, which is the alias.
That lets me compile using the FileWatcher.
As for why this happened, it's still a mystery to me.

Running MGWT in Super Dev Mode does not pick up code changes

I was evaluating MGWT for the new mobile version of our website. So I downloaded the MGWT's showcase project and set it up in my Eclipse. I was able to compile the project and run it. I was then trying to set up the showcase to run in the Super Dev Mode environment which would help improve the development speed a lot. I followed the steps in Daniel's blog: http://blog.daniel-kurka.de/2012/07/mgwt-super-dev-mode.html.
Everything was fine. I was able to start the Codeserver. I was able to see the Super Dev Mode popup when I opened up the app. I was able to request the Codeserver to recompile and I could see the compilation messages in the console. I could also see the generated JS files of the recompilation.
However, it seemed that the Codeserver did not pick up the changes I made. I tried to change a simple text, then asked the Codeserver to recompile, but the changes did not show after the recompilation. When I checked the new generated JS files, I could see that the Codeserver still used the old code to recompile.
When I restarted the Codeserver, the changes were recompiled correctly and I could see them in the app.
If anyone has a clue of what I might have done wrong, please let me know. I appreciate your help very much.
Thanks
Just happened to find a solution to my own question:
Instead of adding the source folder to the classpath of the Codeserver run config as in Daniel's instructions, I added this source folder as part of the command line arguments using the -src argument (see here for more info).
So the arguments string for the Codeserver launch config should look like:
-bindAddress <codeserver-ip-address> -src <gwt-source-path> <gwt-module-name>