How to highlight all occurrences of selected word in scintilla/scite? - scintilla

In Notepad++, when select a word by double click or by cursor select, all other occurrences of the word will be selected.
What is the API to call to achieve this in Win32 (C++) platform.

Please checkout the "MatchMarker.cxx" file in SciTE source.

You can set
highlight.current.word=1
in SciTEUser.properties file which can be accessed from the menu Options > Open User Options File.
More options refers to https://www.scintilla.org/SciTEDoc.html .

Related

Em-Editor Custom TSV

I usually deal with large standardize delimiters similar to a “xxxx”,”xxxxx” (comma separated with quotes). Instead of those characters we use the following
Text Character ASCII Character
———————————————
Comma ————-> 20
Quote ————-> 254
NewLine ————-> 174
Multi Value ————-> 059
Nested Value ————-> 082
Currently i use a macro with RegEx to converted to Tab Format by replacing \x{00FE}\x{14}\x{00FE} with \t Is there a method of creating a TSV definition in EE? so i can quickly switch from format to format?
I have attempted without success, changing the delimeter in the Tools → Customise → CSV section, but there is method of replacing quote character
I tried replacing the delimiter in two was \x{14} and \x{00FE}\x{14}\x{00FE}
http://nextcloud.eclipsephoto.net/nextcloud/index.php/s/5b8pen55LW43cPr
I have already tried but did not seem to work,
thank you in advance.
Please enter \xfe\x14\xfe in the Delimiter text box in the CSV page of the Customize dialog box.
Alternatively, you can replace \xfe with a double quote, and \x14 with a tab after you open your file. I wrote a macro for you:
batch_list = editor.filters;
batch_list.AddReplace("\\xfe","\\x22",eeFindReplaceCase | eeFindReplaceEscSeq,0); // replace \xfe with a double quote
batch_list.AddReplace("\\x14","\\t",eeFindReplaceCase | eeFindReplaceEscSeq,0); // replace \x14 with a tab
document.selection.BatchReplace(batch_list,eeReplaceAll,0); // batch replace
editor.ExecuteCommandByID(22529); // TSV mode
editor.ExecuteCommandByID(3894); // heading 1
You can run this macro after you open your data file. To do this, save this code as, for instance, OpenDataFile.jsee, and then select this file from Select... in the Macros menu. Finally, open your data file, and select Run in the Macros menu while your data file is active.
Updates
EmEditor v20.0.901 now allows any arbitrary character to be used as a quotation mark for a CSV format. Please update EmEditor to v20.0.901 (or above), select Customize on the Tools menu, select the CSV page, and click the Reset button to add the Concordance load file (DAT) format to the CSV format list, or you can manually add a new format to your existing list with the delimiter of \x14 and the quotation mark of \xfe.
After you open a DAT file, you can click the "DAT" button in the CSV/Sort toolbar. To select the DAT format automatically when a file is opened, select Properties for Current Configuration on the Tools menu, select the File page, and set the Concordance Load File (DAT) (or your new CSV Format) check box in the CSV files to Detect list box.
If you want to remove quotation marks (or thorns) after you open a DAT file, you can click the CSV Converter button in the CSV/Sort toolbar, and click Remove Unnecessary Quotes button.

Sort "Open Files" in sidebar by alphabetical order?

Is there any way to sort the "Open Files" section in the sidebar by alphabetical order?
The open files section of the sidebar is listed in the same order as the open tabs in the editor, so you can alphabetize the list by alphabetizing the tabs.
There is a plugin called SortTabs that will do this automatically. It also has a couple of other sorting options, including sorting by file type and last modified date.
sortTabs is the way to go as pointed out by Derrick. I would like to add, opening more than one instance of the same file, will not let the linter to work properly. sortTabs helps identify those duplicate instances. Although, written for Sublime Text 2, sortTabs also works well in ST3. Ctrl+Shift+P > sortTabs Menu > choose your sorting criteria.

Assign code snippet to keyboard shortcut in Visual Studio

Anyone knows how to assign key shortcut to specific code snippet?
I would like to assign for instance CTRL+K,CTRL+J to a #region snippet.
Therefore by able to:
select text,
press CTRL+K,CTRL+J =>
selected text would be surrounded with #region .. #endregion.
I hate when I have to take my hands out of keyboard for more time than necessary:).
EDIT: For more understanding, I am asking how to bind key shortcut directly to SPECIFIC snippet. Opening snippet selector wont work for me. If I have to search through all my snippets to get to a the #region one, its worse then writting all its code by myself.
Thx for any suggestions.
Type a < and then type your snippet shorcut(your XML file Name) and then press tab.
you can get more info from this link
https://learn.microsoft.com/en-us/visualstudio/xml-tools/how-to-use-xml-snippets?view=vs-2017
for example i have a code snippet which i've set xml file name and its shortcut to flog
when i want to use it directly to my code i do like this:
<flog and press tab it Works.
The closest solution I've found for this is to copy the intended snippet to your local snippets directory.
e.g. For VS-2015:
%Userprofile%\Documents\Visual Studio 2015\Code Snippets\Visual C#\My Code Snippets
Then open it in a text editor and change the shortcut to something quick and simple such as '1'.
Now to use it, all you need to do is press Ctrl+K+S > Enter > 1 > Enter
Additionally, you can make it even quicker by changing the hotkey for the surround-with command.
(Tools > Options > Keyboard > Edit.SurroundWith)
I think you may want to try adding a <Shortcut> tag inside your MySnippet.snippet file
<Header>
<Title>Square Root</Title>
<Author>Myself</Author>
<Description>Calculates the square root of 16.</Description>
<Shortcut>sqrt</Shortcut>
</Header>
For details check out : https://learn.microsoft.com/en-us/visualstudio/ide/walkthrough-creating-a-code-snippet?view=vs-2019#description-and-shortcut-fields
To add a shortcut, add a Shortcut element within the Header element
For me the fastest solution was to Import a Folder named "1", then Add the snippet (my name was "block") and mark it in the 1-Folder.
Then i can insert the snippet by
<Ctrl+K,X> + <Enter> + <Enter>
First Enter chooses 1 (the Folder with MY snippets) and the second Enter chooses my most used snippet (must be alphabetically first)

How to do block comments in Gherkin?

In gherkin syntax (used by Cucumber and SpecFlow, I can comment out a line by prefixing it with '#'
Is there any way to block-comment multiple lines?
It is not supported by Gherkin, so you have to prefix all lines with #.
If you use the SpecFlow Visual Studio extension (v1.9.2) you can simply select the lines and toggle them into comments and back. The default shortcuts are Ctrl+K,C to comment and Ctrl+K,U to uncomment.
You can also "workaround" this problem in Visual Studio using the multi-line editing feature. (See http://weblogs.asp.net/scottgu/archive/2010/04/26/box-selection-and-multi-line-editing-with-vs-2010.aspx). You just have to select the beginning of the lines with holding ALT and using the mouse. Using this feature you can type in all the selected lines at the same time. You can also remove all of them similarly, selecting all the # characters for deletion.
Yes, there is. It's called PyStrings type comments. See example at http://docs.behat.org/guides/1.gherkin.html#pystrings.
It will work if you use it just after Feature or Scenario and some other elements.
Feature: my feature
""" some block comment
still block comment
""" end of block comment
Scenario: my feature
""" some block comment
still block comment
""" end of block comment
One the other hand it will not work if you want to comment out some steps.
I think you can configure your IDE to comment out a line on standard key combination. For example IntelliJ recognizes *.feature files and allows to comment out line out of the box. The same possible to do with Notepad++ or even VS.
Single line comment : #
Mutli line comment :
Starts with """
Ends with """
In Eclipse, for commenting single/multiple lines of Gherkin feature file content, we can also do the following.
Add new file association
Windows > Preferences > General > Editors> File Associations > File types: > Add...
and add a new file type as *.feature
Associate an editor for new file type
Associated Editors > > Add...
add Properties File Editor (Default).
Now reopen the file if it's open and it will open in Properties File Editor instead of Text editor.
Doing this allows me select any number of lines and comment-out using the common commenting shortcut Ctrl+Shift+C
Use CTRL + /
It works great. Multiple line comment
For commenting :
Single Line --> #
Multiple Line --> """
Use Command key + '?' key to comment multiple lines for cucumber scripts in MAC.
There's no block commenting in Gherkin, however you can comment multiple lines at once by selecting that block and hitting ctrl + /
You could achieve it by selecting all the lines that you want to comment and then pressing "Ctrl + plus/equals key + /" keys in eclipse.
I don't think it's supported, actually. I have been doing Cucumber related work for about 2 years now and I never seen it.
You'll have to do lot of #-lines ;).
I would start reading the great wiki on github (https://github.com/cucumber/cucumber/wiki/Gherkin)
In Eclipse, for commenting single/multiple lines of Gherkin feature file content, we can also do the following.
Add new file association
Windows > Preferences > General > Editors> File Associations > File types: > Add...
and add a new file type as *.feature
Associate an editor for new file type
Associated Editors > > Add...
add Properties File Editor (Default).
Now reopen the file if it's open and it will open in Properties File Editor instead of Text editor.
Doing this allows me select any number of lines and comment-out using the common commenting shortcut Ctrl+Shift+C
Well, I have so far used # to comment the test steps. If you use this, you should individually comment out each and every line, scenarios and examples which ever applicable. Though this is not recommended, still, I dont see anything similar supported in gherkin yet.
Select all the lines you want to comment and press cmd+shift+c.
There's no block commenting in Gherkin, however you can comment multiple lines at once by selecting that block and hitting ctrl + /

Search certain files only

In VS2010 is it possible to search within a certain file type only?
I want to search just my cs code and exclude .aspx files and VS generated code from datasets and edmx files.
Go to Find in Files and fill out your search string in Find What: and expand Find options and fill out Look at these file types: with *.cs.
Under Find and Replace/Find in Files (Ctrl+Shift+F), expand "Find options", then you'll notice a box called "look at these file types". Enter "*.cs" in there, and it'll only look at files with the .cs extension.
For more information, you may refer to http://msdn.microsoft.com/en-us/library/dechx2tz.aspx.
Use the Find in Files search.
You can specify the extensions of the files you want to search.
On the "Find in Files" dialog, there is a 'Look in these file types' option, under 'Find Options'

Resources