I have been mainly using vim to code in Java and everything works great. Recently I've tried to code in JavaScript however vim appears to be having some issues. It is because of the prettier plugin which I have recently included (java works well though). I attempted to write a simple JavaScript Hello World program just to test if things are working. However, every time I attempt to save in a file ending with .js extension an error appears at the bottom left of my vim page.
The error looks like this.
After I press enter or some other command it changes everything I typed in the file to this.
Edit: I also tried it out on a Python file and there was no issue with Prettier.
I use Vundle as a plugin manager, I have included this in my .vimrc:
Plugin 'prettier/vim-prettier', { 'do': 'yarn install' }
I'm wondering if there is a way to fix this. I already tried reinstalling the plugin, I even tried downgrading the version. Nothing seems to work. Has anyone bumped into this before? If so, how did you guys tackle the issue?
Related
I recently tried PhpStorm and it's great especially with the completion.
When I Ctrl + Space (mac) I get suggestions that actually exist, like when I'm in a JS file and my project has jQuery I get Element Suggestions when typing $("#.
But in VS Code it feels like all suggestions come from AI and aren't even based on what is present in my project.
EDIT: Because I have difficulties describing what I mean I uploaded this video to help you understand my problem
Is there any way to get similar behavior in VS Code?
Yes, there is a way to improve IDE suggestions, and that is by installing extensions for the particular programming language that you use.
So, based on the tags you added for your question, for PHP, you can install "PHP Intelephense", for jQuery you can install "jQuery Code Snippets" and for HTML install "HTML CSS Support".
You can very easily install all 3 extensions by clicking on the "Extensions" option on the left hand side of the IDE (little cubes).
I started learning coding in javascript. Wanted to practise my skills using visual studio code but I cannot run the code (to test if it works). Ive spent many hours browsing google to find the setting, but so far I got to this jsconfig.json thing, placed it in my folder where other .js files are, but the .js file with my practice code still doesnt run. I right click in the field with javascript code, press run the code and it still doesnt run. I guess I am still missing something.
Would you be so kind to please advice me step by step what to do?enter image description here
I have found the settings in Visual Studio Code to enable type checking for JavaScript in JS files. Such that: Bad code is highlighted and it also shows the reason why it's bad code
This behavior does not occur for JavaScript code in Vue files. I have searched through all the settings in Visual Studio Code. I have scoured the internet for any extension that can do this for me to no avail.
How can I make my Vue files type-check the JavaScript in them?
LOL. I found the answer.
All I had to do was add //#ts-check directly underneath the script tag and type checking was enabled.
So HAPPY!!!
Thank you, everyone, for your input
For best results I'd suggest starting a new project using vue-cli and selecting the options for TypeScript and ESLint. You'll also need the ESLint extension for VS Code.
Here's a helpful blog post showing the parts of this process.
Once you have a nicely working setup with the clean project, then move the code over. I suggest this because getting all the config right can be a mess with an existing project.
All is in the title. I'm working in NextJS. When I make a change in the organization of my project's file, a strange message
".cache/typescript/2.9/node_modules/#types/react'"
appears on my imports, specifically my Reactjs's imports. I have tried to retrace the problem by Googling but I have found nothing helpful. Does anyone know what that means? Any hint would be great.
That was simply a fail with some version of VSCode, after having realized an update to the latest version it works well now.
Well I recently started off with atom and p5.js well I am very new to JavaScript. Here comes my problem : When I try to run the file it shows me "sketch.js is not a .py file, exit" . I checked the the selection is set to JavaScript but can't figure out what is wrong.. Please Help !
Well the "sketch.js" is the default one which comes with "p5.js" and yes I have installed "node.js" so no issues with that and the problem comes when I edit the "Sketch.js" template and try to run it , it shows saving and after that it says "sketch.js is not a .py file, exit"
You need to isolate your problem. Is the problem in the Atom editor, or is it with P5.js?
Try running your sketch as a standalone .html file that you create with a basic text editor (like JEdit or Notepad, not with Atom). Can you get that working by itself?
Then try running a more basic JavaScript application in Atom. Try simply printing something to the console. If you're still getting the error, then you know it has nothing to do with P5.js.
Isolating your problem like this will help you refine your Google searches, and it will make it easier for people to help you.
Note that P5.js does not require node.js, which runs on a server. It requires regular client-side JavaScript.
I'll also just note that if you're having trouble with stuff like this, it's a good idea to stick with a basic text editor and write and run your code by hand for a while. Code editors hide a lot from you, which can be nice, but not if you're still learning the fundamentals.
You are likely using an editor like Genie or something which runs python programs by default. Have you installed node.js? If not install it and then browse to the directory using command prompt. Then run "C:\Program Files\nodejs\node.exe" file.js