Notepad++ not detect .js file as javascript code - javascript

I am writing javascript code using notepad++. I found this problem and i don't know how to solve it.
When i open/create a new javascript file, i have to set the language to Javascript so the display will be changed.
Here's the example.
i wrote a line "testing script"
And then i made it as a comment line, but the font color is still black. The comment should written in green color.
I need to change the language to Javascript so it could be read as a javascript code and i could use the shortcut, just like ctrl+q to comment a line.
I don't why this is happened. But it just happened after i update notepad++. Can anyone help. This also happened when i open existing javascript code.

I am also using the newer version of notepad++ but the comment function is working great. just to sure try saving it first with the js extension and then try to comment the line it. hope it works for you!

Related

Git detects changes for the whole file once opened but not changes were made. Using windows and vscode

I have created a repo on Github, and pushed exercise files to practice on. When I open one of these files and hit ctrl+save or add a single line of code the editor marks everything as changed. Even when I have made not changes or just a single line change.
For example, on the first image - I did not change anything but ctrl+save changed the formatting which should not be a problem.
In the second image, it is possible to see that almost the entire file changed but in reality is the same
I am using VSCode and Git with the latest updates on Windows.
Much appreciate any guidance!
I think it is because on the save action you have some kind of automatic code formatter tool enabled, like prettier.
If you want to skip this formatting action then this might help: How do I turn off text formatting on save in visual studio code?

My js code doesn't show any definition when hover or press ctrl+k or ctrl+space

My question simply is:
I can't show any definition when hover on my specially my javaScript code
even by hovering or pressing ctrl+k or ctrl+space
I tried my ways but I can't reach this point
Installing the Visual Studio IntelliCode extension will fix that.
But even with that installed, since JavaScript is a loosely typed language, things like variables will just show any when you hover over them.
Installing IntelliSense removed this issue for me.

sublimetext3 - broken js syntax in php file

Sublime Text - Version 3.0, Build 3143
I deal with a lot of php files that contain HTML, CSS and JavaScript. The only problem I've found so far is when I'm looking at script tags in a PHP file. The syntax is set to PHP but comments outside of JS functions break the rest of the code below it (it looks like it's trying to detect regex?)
When I move the // test comment into the function then all is well:
I'm curious to know where the problem exists and maybe find a fix.
Color Scheme doesn't affect the syntax highlighting (it still breaks in other color schemes)
Adding type="text/javascript" to the script tag doesn't fix anything
My finger points to the PHP syntax highlighting ... but if that's the case, how can this be fixed?
Fresh install of Build 3143(Windows), opened as "PHP" and everything works. It can be caused by some custom settings you made or third party plugin.

Saving HTML code as its own application

How do I save or convert the HTML code into its own program? For example: I want to double click on the file on my desktop to open up as its own application. I don't want it to open through Notepad++ or any other program.
The best way I can explain this is: look at all of your desktop icons. When you double click something it runs on its own. It doesn't need Notepad++ or whatever coding program you used to open up first. Now implementing that exact same concept to my question. I want to open the program I have coded in it's own window.
I hope that makes sense. I don't want to show my code because it's original.
EDIT: The HTML code consists of CSS and JS. Can I open it without a browser? Example: Visual Basics you can create window applications. I was wondering if I could do the same thing except with HTML code?
Thank you in advance!
You right click on the icon, and choose Open With: which should bring up a list of applications you can use to open that type of file.
And you can browse to the location of the program you want to use to open the file.
Hope that helps.
HTML is not compiled into anything, and thus cannot be run independently. It must be interpreted by a browser or other similar piece of software.
If you have written what you deem a 'program' in HTML/JavaScript, then your best bet would be to host it somewhere and bookmark the page to your desktop. I hope this answers your question...

How to highlight (un)used JavaScript live in Dreamweaver

I am working in Dreamweaver CS4 and implemented JQuery code that I found online for a gallery function.
I am only using a very small part of the gallery functions available, and would like to delete the unused script in order to get more clarity and a cleaner script. But as a JavaScript beginner I can't identify what is important and what is not.
My question: Is there a way in Dreamweaver to view/highlight the JS code that the site is using? I am imagining a tool that you could turn on when running the live view that would visualize the portions of code that is being used.
Or, the other way round, is there a way to highlight the unused code.
The live code button doesn't seem to do this.
Thanks for your help!
My question: Is there a way in Dreamweaver to view/highlight the JS code that the site is using?
No. You would need to use Firebug or a similar javascript tracker/debugger to see how the code is used. The most DW will tell you is which external files are linked to a page.

Categories