How to select hyphens separated words with Netbeans? - netbeans

I have variables separated with hyphens and I would like to select them entirely by double-clicking on them on Netbeans.
I just can't find how to set that up...
I know you can with Sublime Text : In Sublime Text 2, consider hyphen as part of word
UPDATE:
It apparently works for CSS but I'm using SCSS.
Class names, variables and CSS attributes are not selected properly on double click.
.navigation-container{ //not properly selected
#{$nav-middle}{ //not properly selected
> ul ul{
align-content: center; //not properly selected
}
}

Related

wrong auto comments for scss in vscode

I'm having an issue with the auto comments in my .scss files. By auto comments I mean 'CTRL + /' to comment out the selected code. When I'm in my scss file and I do this, it adds the JS comments '//'. So the output looks like this:
body {
font-size: 1rem;
line-height: 1.4;
// overflow-x: hidden;
}
When it should be:
body {
font-size: 1rem;
line-height: 1.4;
/* overflow-x: hidden; */
}
If I rename the .scss file to .css then the auto comments work correctly. I'm guessing this has to do with a setting inside of VSCode, either user or workspace setting?
I believe this is working as expected, as SCSS supports both ways to comment, and I do not think there are any settings in Visual Studio Code you can change to change how the comment style works.
Ctrl + / is "Toggle Line Comment", which is the // way. If you want to comment using the multi-line comment format, you can instead highlight what it is you want to comment, and perform Shift + Alt + A.
However, there is another way to change how the Line Comments work:
Find where Visual Studio Code is installed on your system, and go to resources → app → extensions → scss
In the scss folder should be a "language-configurations.json" file. Open it.
Change the lineComment property to be either a blank string, or delete it outright.
"lineComment": ""
Save the file, and restart Visual Studio Code. Now when you perform Ctrl + /, it should comment using the style you prefer.
Please see the comments to #Timothy's answer. I have previously written an extension to deal with these issues, Custom Language Properties, that allows you to easily change things like line or block comments for many languages.
But setting lineComment to the OP's desired ["/*","*/"] did not work. In looking at the scss language configuration file, an array of values is not allowed for line comment values. But it works to delete the lineComment key or setting it to the empty string "".
However, although probably rare, any language configuration file can be overwritten whenever vscode updates and you would have to go back and change the file again. Hence the extension.
With this setting:
"custom-language-properties": {
"scss.comments.lineComment": ""
}
this accomplishes the same thing as editing the underlying language-configuration file. And fortunately, at least in this case, apparently vscode will apply the blockComment value when the lineComment value is missing or inappropriate. And fortunately that blockCcomment style is what the OP wanted.
That is valid comment syntax for SCSS, and it's probably the correct default.
Single-line comments (which start with //) are always removed from the compiled output, which is usually what you want.
Multi-line comments (/* comment */) are only removed in compressed mode.
Source: Sass: Comments

Hide certain characters in a text field in Flutter

I have a text field which I need to style for example with bold or italics parts.
I tried overridding the TextEditingController's buildTextSpan and formatting the text using annotation ranges with custom styles but the edge cases were too much and I really couldn't get it to work.
So, thought about using a formatter where before every change in format I'll add a custom character, like this:
This text is |bBOLD and this is |iITALICS. Would get me this:
This text is BOLD and this is ITALICS. So I override the buildTextSpan to build the TextSpan from a parse function where I split the text by the special characters and check the initial letter of each text for formatting info.
This works well except for the fact that when I press the right arrow to go the next character after the "This text is ", the cursor will stay fixed as it thinks there are two characters but being only for formatting, they aren't there on the render.
Is there any way I could tell the textfield to ignore certain characters when selecting, moving selection or typing?
I think this would work!
static const kCharToBEIgnored = 0x2C;
// Here 0x2C means ',' comma
// For complete list visit https://api.flutter.dev/flutter/charcode/charcode-library.html
String get text {
return String.fromCharCodes(
_value.text.codeUnits.where((ch) => ch != kCharToBEIgnored),
);
}

In Visual Studio Code wrap an HTML tag on a single line with Emmet

I know how to wrap a single line of text in an HTML tag with Emmet by using Wrap with Abbreviation. It works. However, it produces the following output:
<h1>
HTML5
</h1>
What I want is this:
<h1>HTML5</h1>
I can make some progress with this in my User Settings:
"emmet.syntaxProfiles": {
"html": {
"tag_nl": false
}
}
However, my output then looks like this, with extra whitespace:
<h1> HTML5 </h1>
Oddly, if want to individually wrap a selection that contains multiple lines, visual studio behaves as I want. It is just individual lines that cause this behavior. For instance, if want to wrap this:
foo
bar
I end up with this, which is what I what I want:
<h1>foo</h1>
<h1>bar</h1>
Is there a way to sort this out? I just want to wrap some text in a tag with no fancy formatting:
<h1>HTML5</h1>
It is perhaps worth pointing out that WebStorm and Atom wrap as I expected. This is a Visual Studio Code specific thing.
I tried your code:
"emmet.syntaxProfiles": {
"html": {
"tag_nl": false
}
}
It works now perfectly with single line selection, but is still buggy with multiple lines (extra tabs & spaces added)

How to display newline in TimelineItem control's text property?

We have a SAPUI5 timeline control, where we are showing the comments coming from server.
The issue is, if the comments contain a newline \n, then the Timeline control is not able to display the text in newline. Instead, it introduces space wherever \n is present.
We have tried formatting \n to unicode character also but that also didn't worked. Timeline control aggregates TimelineItem.
The control we are using is: https://ui5.sap.com/#/api/sap.suite.ui.commons.TimelineItem
Code snippet can be found at:
https://jsbin.com/kuluyehilu/edit?html,output
I inspected your example and came up with the following solution.
Since the text is embedded in a <span>, all unnecessary whitespace will be trimmed. What you can do is telling the span (via CSS) that it should display the whitespace anyway.
If you don't have a CSS file in your project yet, create one. Then add the following lines
div.sapSuiteUiCommonsTimelineItemShellBody>span {
white-space: pre;
}
This should do the trick.
JSBin: https://jsbin.com/feladeneso/1/edit?html,output
If you inspect the rendered element, you will see it actually put in the break:
<span id="__item0-realtext">x
y</span>
...but did not convert it to a <br/> tag. You cannot add the tag yourself since it will be escaped, either. Maybe you can try to override the renderer, and convert any line breaks to html breaks

wysihtml5: Copying text from a word document to the editor

When copying text from word to the wysihtml5 editor, the text gets messed up (both in term of formatting and in terms of additional added characters). Is there an easy fix for this? The correct behavior I am looking for would be the way Stack Overflow's rich-text editor works - the text copied and pasted from word looked identical to the word document.
Thank you!
Update:
To solve the problems observed with the formatting of the pasted word text, I added the line "p": {}, in the used wysihtml5-0.30_rc2.js file. The line was added in the declaration of the defaultOptions[parserRules][tags] (see used resource).
Still, now I can see at the beginning of the pasted text a "Font Definitions" paragraph:
<!-- /* Font Definitions */ #font-face {font-family:Arial; panose-1:2 11 6 4 2 2 2 2 2 4; mso-font-charset:0; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 0 0 0 1 0;} #font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; mso-hyphenate:none; font-size:11.0pt; font-family:Arial; mso-fareast-font-family:Arial; mso-bidi-font-family:Arial; color:black; mso-fareast-language:HI; mso-bidi-language:HI;} a:link, span.MsoHyperlink {mso-style-unhide:no; mso-style-parent:""; color:navy; mso-ansi-language:#00FF; mso-fareast-language:#00FF; mso-bidi-language:#00FF; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {mso-style-noshow:yes; mso-style-priority:99; color:purple; mso-themecolor:followedhyperlink; text-decoration:underline; text-underline:single;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt;} #page WordSection1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt
90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.WordSection1 {page:WordSection1;} -->
This only happens when I use Firefox, and does not happen in Chrome. Any ideas on how to get rid of this problem?
wysihtml5 includes a parser that analyses all text that gets pasted in its text area and applies the filter rules that are defined in the parserRules config object. Adding "style": { "remove": 1 } to your parserRules should do the trick.
To understand the Firefox problem, you have to see the raw clipboard HTML content (originating from Word) that gets pasted into the text area. Just copying some Word text and pasting it into a text editor won’t help because the text editor requests a text-only variant of the clipboard content.
If you’re on a Mac you can see this raw clipboard content with the help of the ClipboardViewer tool that you have to compile yourself with XCode. The desired HTML content should be in the public.html or Apple HTML pasteboard type fields. Maybe there exist other tools that don’t need to be compiled and/or that work on other operating systems.
Now you should see that your clipboard content from Word actually looks something like
<span>
<!--
/* Font Definitions */
...
div.WordSection1 {page:WordSection1;}
...
-->
</span>
So by removing the style tag (with all of its content) the font definition junk disappears.
Have a look at wysihtml5’s parserRule demo to see some more advanced configuration options.
I've solved this by overriding wysihtml5.dom.getPastedHtml. Just add this after you've loaded wysihtml5:
wysihtml5.dom.getPastedHtml = function(event) {
var html;
if (event.clipboardData) {
html = event.clipboardData.getData('text/plain');
}
return html;
};