Need help p5.js and Atom Text Editor - javascript

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

Related

Is there any way to get "good" Autocompletion in VS Code?

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).

How do you get an HTML element ID to autocomplete in VSCode JavaScript?

I'm trying to get intellisense to work with JavaScript in VSCode, but when I try to reference an HTML file in the project it doesn't recognize IDs.
In the picture you can see the same project works fine in Visual Studio.
Is there a way to get this functionality in VSCode?
Sadly, Visual Studio and VS Code are two completely different software's. Visual Studio is an IDE (Integrated Development Environment), this means it has more features than a normal text editor (for example VS Code or Atom). VS Code is a text editor, however you can install extensions to make it more into an IDE.
The best solution is to look at VS Codes market place and try and find an extension that will auto complete the HTML tags. I personally haven't found any extension for it.
Hope this helps, if you need any more advice or help DM me on discord CallumS005#9458 and I'll be happy to try and help.

Vim Prettier Plugin causing errors in file ending with .js extension

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?

Sublime text editor 3, Not saving But saving

I spent around 6-7 months, trying to learn code a while ago.
Learning the basics of HTML, CSS, javascript, jQuery and a few others.
I have had a break from it for a while as it was
confusing me & other things in life came up.
Now I'm ready to start again.
I have created a simple HTML file & trying to manipulate it via Javascript.
But each time I try and save the javascript file I am getting the following error (Shown in Sublime).
[WinError 2] The system cannot find the file specified
[cmd: ['esvalidate.cmd', '--format=sublime', 'C:\Users\ManDoesNotSubmit\Desktop\Es6NorwichAds\Es6NorwichAdverts.js']]
[dir: C:\Users\ManDoesNotSubmit\Desktop\Es6NorwichAds]
[path: C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\ProgramData\Oracle\Java\javapath;C:\php;C:\WINDOWS\System32\Wbem;C:\PHP]
[Finished]
It is confusing me because when I close sublime & re-open the document,
my new changes have been saved but it is still throwing this error....
I have searched forums, Youtube etc.
But all the responses I have found are regarding Python, Build systems & syntax errors.
Not the specific problem I am having.
I am running windows 10, on a cheap laptop.
I have checked the system environment variables & JS is present in both the extensions & path sections, so I cannot understand why it is throwing an error..
I am opening the file directly into sublime, from my desktop so If it could not find the file, it simply would not load the small amount of script I have written..
Any help would be appreciated.
Sounds like you're missing the sublime-jsvalidate npm package. See here
To be more precise: the error you're getting is about esvalidate.cmd not existing, not the file you're trying to save.

NetBeans: Javascript Code Completion doesn't work as expected

I've just started using NetBeans (PHP version 7.2 for Mac) and love it so far. One thing that I haven't been able to figure out is how to get Code Completion to work for Javascript files in the same fashion as it does for PHP, CSS and HTML files. For example, if I type "fun" in a PHP file, it'll pop up a box that allows me to choose "function":
If I do the same thing in a Javascript file, I get nada:
I've looked all over the place and I have not found a way to add this functionality. Your help would be greatly appreciated.
For this example, try the Source-> Complete Code command (Ctrl+Space by default).
In any case, the JavaScript editor is currently being rewritten from scratch so better code intelligence is to be expected in the near future.
Edit: I almost forget the most obvious answer... Make sure your file belongs to a loaded project. Code intelligence doesn't work properly outside projects.

Categories

Resources