Notepad++ does auto-complete for html and also for JavaScript. but the auto-completion depends on file extension.html file supports completion for html only. Is there a way to enable auto-completion for javascript in the script tag of an html file? I mean, other than copying the auto-completion keyword list from "javascript.xml" to "html.xml" files...

As suggested on stackoverflow, asking on superuser, as I could not find a satisfactory answer there. If anyone has any idea, please let me know! (I hope I am not the only one having this kind of an requirement! :))

  • What's wrong with copying the auto-completion keyword list from javascript.xml into html.xml? Seems like a pretty simple solution to me. – heavyd Mar 1 '11 at 12:25
  • Agreed, its simple... but the problem in that is the list/suggestions will be displayed everywhere in the page, even in the non-javascript part..! That becomes cumbersome actually.. listing all javascript suggestions in html.. I am expecting it to handle it a bit more intelligently, if possible! :) – Nikhil Mar 1 '11 at 12:38
  • Short of writing your own lexer as suggested in the StackOverflow answer, I doubt there is an easy way to make this happen. – heavyd Mar 1 '11 at 13:29
  • :( ohk.. So I am the only one with this requirement.. :) anyways.. thanks for your help,heavyd.. Not being a dev for windows applications find it difficult to write a lexer for npp, but if I ever do attempt to learn and try, will reply here for sure! :) – Nikhil Mar 4 '11 at 3:58

Autocomplete feature is disabled by default,
but a simple Preferences setup will get you using the new auto-complete feature in no time at all. Go to Settings -> Preferences, and switch to the Backup/Auto-competion tab. At the bottom of that screen you’ll see where you can enable auto-completion, and you can optionally turn on the “show function parameters” feature as well. It works for CSS, PHP, Javascript, and html also.

| improve this answer | |
  • With this turned on when I type document. into a script tag it doesn't show me options like document.write or document.getElementById. – user3015682 Jun 17 '19 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.