Set sgml-mode as default in nXhtml - html

Well, I have already provided self-explanatory title. =) I use nXhtml for web development, and sgml-mode keybindings suite me better. Is there any chance that I can change default mode for HTML editing?
I reckon that this is probably an RTFM issue, but I find nXhtml documentation quite uptight. =/

Had you tried standard method of setting mode with
(add-to-list 'auto-mode-alist '("\\.html?$" . sgml-mode))
? I don't use nXhtml, so I don't know how it set handler for HTML files.

Related

VS code is not showing suggestions

When I autocomplete an HTML attribute (my cursor is now inside ""), the VS code does not display any suggestions for attribute values. However, if I manually delete quotes ("") and type quotes (""), it suddenly displays suggestions. Is there any way to solve this problem?
A suggestion to change any settings in vscode or an extension that could solve this problem ?
I have also gone through this same situation before I fix it by downloading extension which is specific to your programming language .
Before doing that please check if auto detect is working on VS Code correctly . If it not fix it and check if the problem is solved .
The suggestion list of Basic completion appears when you press the default Visual Studio IntelliSense shortcut Ctrl+Space

VSCode / Auto Close in *.nunjucks

Is there a way to activate the html auto closing in *.nunjucks-files? It only works in *.html-files for me. I found no plugin for this.
I've dealt with this issue too. The solution I found was downloading this extension Auto Close Tag. You can configure it's "auto-close-tag.activationOnLanguage" setting to include any language, such as "nunjucks".
It's my understanding that you need to also download a language support extension for Nunjucks. This is an extension that allows you to pick Nunjucks in Select Language Mode in VSCode. Personally, I like this one: Nunjucks by ronnidc, but you can use the one that you like.
The only caveat is that the name for Nunjucks in VSCode (the one you see when you select language mode) needs to match up with the name you have in the "auto-close-tag.activationOnLanguage" settings. For me it's "nunjucks"; case-sensitive.

Visual studio code comment in HTML files

I am trying Visual Studio Code lately and i've noticed that when i try to add a line comment in an HTML file (using Ctrl+/ or Ctrl+K Ctrl+C) instead of this: <!-- -->, i get this {# #}.
In JS or CSS files the key bindings work just fine and produce the expected result.
So how can i get the proper type of comments in HTML files?
Finally i found what the problem was. I had installed the twig plugin (for the Twig php template engine) and that was causing the comments issue.
I've just installing VSCode 1.1.1 and try to put a comment in an new html file
To do so, your new file must be,first, save in .html format and after that, you can use CTRL-K CTRL-C to put a comment and it works.
Hope that help you
If you don't want to disable/uninstall any plugin, you can create a snippet to put a comment. For example, I create a snippet that add HTML comments in a PHP file:
"comment HTML": {
"prefix": "chtml",
"body": ["<!-- $1 -->"],
"description": "Comment HTML line"
}
You can insert that right after the comment in File > Preferences > User Snippets > {YourExtension}
Then, when you start typing 'chtml' in that kind of files, IntelliSense will prompt that snippet.
Maybe this is a workarround, but it works excellent for me. Hope it helps!
https://code.visualstudio.com/docs/customization/userdefinedsnippets
For me, it was the (Djaneiro) extension, it made the html files default to django template, so it caused the comments to be wrong in HTML (when pressing ctrl + / )
(commenting them with {% comment %})
List of extensions known to cause this unwanted behavior (Based on my own experience and other answers):
Hugo Language and Syntax Support
Djaneiro
Nunjucks
Tornado
Sublime Babel
Babel
Twig
Django by Baptiste Darthenay (v1.0.0)
(Feel free to edit this answer and add yours)
You may need to restart code after disabling your extension (I did).
In your Visual Studio Code windows, go to File->Preferences->Keyboard Shortcut
This will open two files beside each other like in the screenshot below:
here you can change or create your own shortcuts.
Like I just replaced Ctrl+KU to Ctrl+/
Hope this will work for you !!
For me, the offending extension was Nunjucks (the templating language plugin assumes every .html file is a nunjucks html template)
For others having the problem, the Tornado extension is also a culprit. I had to "disable (workspace)" one by one to find it.
Try uninstalling any python extension packs you may have installed! You can then reinstall the python extension you need individually.
Chances are one of the extensions in the bundle of that extension pack is causing the issue
Click (Ctrl + K C) to comment the html.
Click (Ctrl + K U) to uncomment html.
For me, this was caused by the Sublime Babel extension. Disabling it and restarting VS Code fixed the issue: Cmd+K, Cmd+C works again, as does Cmd+/ for toggling. Also, HTML comment blocks are now correctly styled again.
You can configure the file type at the bottom right corner. you probably are on Django HTML. you can set it to HTML.

Disable rule in sonar

I want to disable a rule from Sonar so it doesn't show the results in the web page.
In my case I want to hide (or not capture) the results about trailing comments.
Is it posible to configure it somewhere?
Thanks.
The right way to do is to put something like this on sonar-project.properties file per project:
sonar.issue.ignore.multicriteria=e1,e2
# tab characters should not be used
sonar.issue.ignore.multicriteria.e1.ruleKey=squid:S00105
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.java
# right curly braces should be on a new line
sonar.issue.ignore.multicriteria.e2.ruleKey=squid:RightCurlyBraceStartLineCheck
sonar.issue.ignore.multicriteria.e2.resourceKey=**/*.java
There are docs here on how to ignore specific rules for specific files, which links to an example of how to search for specific rules, by language. This page on baeldung goes into additional detail better than the docs
You have to remove this rule in the quality profile that you are using to analyse your project.
Please refer to the documentation that describes all this: Quality Profiles in Sonar.
In web interface for particular rule just press Deactivate button:
Adding to #Vladmir's answer in a new answer as I am not able to comment.
You can not modify the built-in profiles. If you don't see the option of Deactivate, then copy the profile and set it as default. Now you will see the options to activate/deactivate.
An additional note for people ending up on this thread. I tested this quite a lot and finally found that setting common rules (anything that starts with "common-xxxx") from scanner side (pom, command line etc) will be ignored and it wont work. The language specific rules can be passed line arguments and thats why the "squid:S00105" rule is getting ignored correctly. Here is the issue link on the SonarQube JIRA board and it says that it "wont be fixed".
https://jira.sonarsource.com/browse/SONAR-8230
Here is the link to my answer: https://stackoverflow.com/a/60570763/1766402
on how to set it from UI.
You can't deactivate sonar way rules in a built-in profile. so you have to create your own profile by going to the Quality Profile section and choosing your desired language then click on the config icon the select copy with your favorite name and then you can change any rules in that
and then you can deactivate your considered rules
For Java, You can get sonarlint/sonarqube to ignore false-positives by just commenting //NOSONAR at the end of your code statement. As mentioned in my answer here

Disabling keys in browser?

I'm getting started on a module for my website, looking for a method that extends flash (for example, something I can do with JavaScript) to disable keyboard commands. For example, I'd like to be able to disable the F1 key, so that it doesn't open up the support tab in Chrome. I looked into access keys, but they don't seem to be a good solution. If anyone has info on how this may be possible, even which language I should be looking into, or even if they have attempted it and simply found it to be impossible, please let me know.
I am not sure if other browsers then Chrome works for you, but have you tried some of these solutions?
[1] How to disable default Help function of browsers
[2] Disable F1-Help key in browser and set your own help file or link or pages etc...
[3] How to Disable Function keys using Javascript?