• Terraform HCL syntax highlighting support

    14
    0 Votes
    14 Posts
    14k Views
    mmannionM

    I know this thread is old, but it’s come up as the top hit in web searches periodically over the past year, so I figured I’d post a reply here.

    I configured a user-defined language for HCL - at least a fledgling one - based on the documentation references that @PeterJones cites in the second post in this thread, as well as a cursory review of the HCL language spec. The relevant configuration is posted below, with the following caveats:

    I barely know HCL, this is my first Notepad++ UDL, and I’ve only spent about 2 hours on this so far, so set your expectations accordingly

    I’m posting this draft UDL in case it might help others get started, but…

    I’m not planning to maintain this as a project, so please don’t request fixes/enhancements

    I defined the new language using the Notepad++ 8.1.9.1 Language > User Defined Language > Define your language dialog

    Accordingly, the configuration below was persisted in my %APPDATA%\Notepad++\userDefineLang.xml file

    Another thread I read said that this is the old way of storing UDLs (the new way being the userDefinedLang directory) but the doc states that this is the method the configurator dialog uses, so voila

    I’m using dark mode with some global overrides, so you may need to change the colors just to make them readable if you’re using a light-colored background

    Two limits of which I’m aware are:

    Folding doesn’t work. This seems to be due to the fact that I’ve defined curly braces as the folding delimiter, but also as operators and in another delimiter (I can’t explain it better than that at the moment).

    Heredocs aren’t formatted specially, like you get with the built-in “shell” language, for example. I think that UDL just doesn’t support heredocs - but it’s equally likely that I just don’t know how to do it.

    You should be able to add the following to your userDefineLang.xml file (creating the file, if necessary) and restart Notepad++. Once you do, you should see a new “HCL” choice at the bottom of the Language menu (note that this won’t show up under the “H” sub-menu along with the built-in languages):

    npp_hcl.jpg

    Here’s the content of my userDefineLang.xml file:

    <?xml version="1.0" encoding="UTF-8" ?> <NotepadPlus> <UserLang name="HCL" ext="tf" udlVersion="2.1"> <Settings> <Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" /> <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" /> </Settings> <KeywordLists> <Keywords name="Comments">00# 00// 01 02 03/* 04*/</Keywords> <Keywords name="Numbers, prefix1"></Keywords> <Keywords name="Numbers, prefix2"></Keywords> <Keywords name="Numbers, extras1"></Keywords> <Keywords name="Numbers, extras2"></Keywords> <Keywords name="Numbers, suffix1"></Keywords> <Keywords name="Numbers, suffix2"></Keywords> <Keywords name="Numbers, range"></Keywords> <Keywords name="Operators1">+ - * / % &amp;&amp; || ! == != &lt; &gt; &lt;= &gt;= : ? { } = =&gt; [ ] ( ) . , ... ${ %{ ~</Keywords> <Keywords name="Operators2"></Keywords> <Keywords name="Folders in code1, open">{</Keywords> <Keywords name="Folders in code1, middle"></Keywords> <Keywords name="Folders in code1, close">}</Keywords> <Keywords name="Folders in code2, open"></Keywords> <Keywords name="Folders in code2, middle"></Keywords> <Keywords name="Folders in code2, close"></Keywords> <Keywords name="Folders in comment, open"></Keywords> <Keywords name="Folders in comment, middle"></Keywords> <Keywords name="Folders in comment, close"></Keywords> <Keywords name="Keywords1">data default dynamic locals module output provider resource terraform variable</Keywords> <Keywords name="Keywords2">false null true</Keywords> <Keywords name="Keywords3">else endfor endif for if in</Keywords> <Keywords name="Keywords4">abs abspath alltrue anytrue base64decode base64encode base64gzip base64sha256 base64sha512 basename bcrypt can ceil chomp chunklist cidrhost cidrnetmask cidrsubnet cidrsubnets coalesce coalescelist compact concat contains csvdecode defaults dirname distinct element file filebase64 filebase64sha256 filebase64sha512 fileexists filemd5 fileset filesha1 filesha256 filesha512 flatten floor format formatdate formatlist indent index join jsondecode jsonencode keys length list log lookup lower map matchkeys max md5 merge min nonsensitive one parseint pathexpand pow range regex regexall replace reverse rsadecrypt sensitive setintersection setproduct setsubtract setunion sha1 sha256 sha512 signum slice sort split strrev substr sum templatefile textdecodebase64 textencodebase64 timeadd timestamp title tobool tolist tomap tonumber toset tostring transpose trim trimprefix trimspace trimsuffix try upper urlencode uuid uuidv5 values yamldecode yamlencode zipmap</Keywords> <Keywords name="Keywords5"></Keywords> <Keywords name="Keywords6"></Keywords> <Keywords name="Keywords7"></Keywords> <Keywords name="Keywords8"></Keywords> <Keywords name="Delimiters">00${ 00%{ 01$${ 01%%[ 02} 02} 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21&apos; 21&quot; 22\ 22\ 23&apos; 23&quot;</Keywords> </KeywordLists> <Styles> <WordsStyle name="DEFAULT" fgColor="FFFFFF" bgColor="808080" fontStyle="0" nesting="0" /> <WordsStyle name="COMMENTS" fgColor="008040" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="LINE COMMENTS" fgColor="008040" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="NUMBERS" fgColor="FF0000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS1" fgColor="FF00FF" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS2" fgColor="FFFF00" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS3" fgColor="00FFFF" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS4" fgColor="00FFFF" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="OPERATORS" fgColor="00FFFF" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN CODE1" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS1" fgColor="8080FF" bgColor="FFFFFF" fontStyle="0" nesting="16781440" /> <WordsStyle name="DELIMITERS2" fgColor="FF0080" bgColor="FFFFFF" fontStyle="0" nesting="128" /> <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS7" fgColor="FF0000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS8" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="1" /> </Styles> </UserLang> </NotepadPlus>

    Thanks to Ivan Radić for his excellent UDL 2.1 documentation; I wouldn’t have made it this far without it.

  • How to delete this on notepad?

    7
    0 Votes
    7 Posts
    599 Views
    Marcin TomczakM

    @alan-kilborn
    Thank u Alan for help and your time :)

  • --> About how to center Text

    3
    0 Votes
    3 Posts
    2k Views
    Alan KilbornA

    @juan-de-dios-jurisch-y

    OK, but what you are describing really isn’t “centering” text – well, maybe visually for you “at this moment” but what if you resize Notepad++'s window? – that “centering” goes to heck.

    So…this “tip” is of extremely low value (sorry).

  • How to style an element in a pre-made UDL? (dark mode problem)

    3
    0 Votes
    3 Posts
    413 Views
    Geoff BaysingerG

    @peterjones Thank you. Got it from there, and the inherit mode on the default style worked like a charm.

  • Crash triggered chronic padding around text editing widget

    7
    0 Votes
    7 Posts
    2k Views
    Terry RT

    @PeterJones said in Crash triggered chronic padding around text editing widget:

    I personally think it’s Slack or other such conferencing software, because some of the earlier reports mentioned other brands of those types of apps, from what I remember… and the whole mess started in late March 2020, right when everyone in the US was starting to frequently use such software for an externally-caused change in working conditions.

    Thanks @PeterJones for that insight and the links. I’ve just had a good read of the github thread. Probably the longest I’ve ever spent on github, don’t have an account there and don’t intend to but have ventured over there on occasion for a bit of “light” reading.

    But I take umbridge at the twitter link. I abhor those social media sites and feel that it is dragging Notepad++ down to even venture into that area, sort of cheapens it! I almost feel dirty having “touched” twitter to see what that link had to offer.

    So for any future issues on the GUI (re)drawing of Notepad++ issue I’ll make sure to reference the github thread. Certainly looks like the diagnostics is a lot further ahead that I believed. That’s good, however it still remains to be seen how the solution will present itself. Given other (MS) apps have also been affected we can hardly expect Notepad++ developers to be made liable to produce a solution.

    Terry

  • Search/Replace Windows out of screen.

    5
    0 Votes
    5 Posts
    3k Views
    PeterJonesP

    A couple years ago, I said,

    Update for future users: instead of the Alt+SPACEBAR trick, you can also try to hit Ctrl+F multiple times. I learned that trick for changing monitors in another thread, and it also seems to work for moving it from mostly off-screen to being well-centered.

    Updated information: newer versions (v8.1.3 and later) don’t allow this, because the second Ctrl+F (which is the first Ctrl+F that the dialog handles) now selects the FIND tab in that dialog, rather than centering the Find dialog box itself. See “Double Ctrl+F no longer moves find dialog” and “Double Ctrl+F won’t bring the find dialog in fromt of the primary window

  • Regular Expression with find a pattern and replace

    2
    0 Votes
    2 Posts
    3k Views
    PeterJonesP

    @shashi-bhosale ,

    When I read your post earlier this week, I had hoped someone else would chime in, because I was pretty busy. Sorry no one else had a chance to reply before I finally found a spare moment to go back through unanswered questions.

    If I have interpreted your request, then if I start with

    CREATE PROCEDURE [dbo].[ki_APSGetTopLevelDemand_BKUP] ( @IpRefType AS VARCHAR(100), @IpRefNum AS VARCHAR(100), @IpRefLine AS INT ) AS blah blah blah CREATE PROCEDURE [dbo].[ki_APSGetTopLevelDemand_BKUP] ( @IpRefType AS VARCHAR(100), @IpRefNum AS VARCHAR(100), @IpRefLine AS INT ) AS

    and use

    FIND = (\)\s*AS) REPLACE = $0\r\n@site = 'Site' SEARCH MODE = regular expression

    After doing the two replacements (or a REPLACE ALL), I get what I think you want:

    CREATE PROCEDURE [dbo].[ki_APSGetTopLevelDemand_BKUP] ( @IpRefType AS VARCHAR(100), @IpRefNum AS VARCHAR(100), @IpRefLine AS INT ) AS @site = 'Site' blah blah blah CREATE PROCEDURE [dbo].[ki_APSGetTopLevelDemand_BKUP] ( @IpRefType AS VARCHAR(100), @IpRefNum AS VARCHAR(100), @IpRefLine AS INT ) AS @site = 'Site'

    If you want to know more about the individual tokens in my search and replace, look at the official search/regex section of the usermanual, linked below, for the following concepts

    token see usermanual section about parentheses capture groups \s character escape sequences * multiplying operators \r\n control characters (note that they are case sensitive)

    ----

    Useful References Please Read Before Posting Template for Search/Replace Questions FAQ: Where to find regular expressions (regex) documentation Notepad++ Online User Manual: Searching/Regex
  • "Function List" current function highlighting is too light? (Part 2)

    3
    2 Votes
    3 Posts
    350 Views
    Alan KilbornA

    @peterjones said in "Function List" current function highlighting is too light? (Part 2):

    regarding “forbidden” error on the older topic: I couldn’t replicate

    I couldn’t replicate either.
    I put a post in the older topic that points here.

  • "Function List" current function highlighting is too light?

    23
    1 Votes
    23 Posts
    3k Views
    Alan KilbornA

    More on the topic of this thread is found HERE.

  • I can't install the JSTool plugin,How can i figure it

    2
    0 Votes
    2 Posts
    3k Views
    PeterJonesP

    @jiyun-gou ,

    When I installed the plug-in, the following screenshot appeared for a period of time, and it restarted directly. But the difference was not installed successfully

    You will have to be more specific.

    If you look in the Plugins menu, is there an entry for JSTool? If not, if you looks at Plugins > Plugins Admin, does it list JSTool under Available, Updates, or Installed?

    I just tried on a fresh v8.1.9.1-64bit: the first time I tried to install JSTool, it restarted Notepad++, but didn’t install. The second time I tried, I saw the progress bar briefly, and when Notepad++ restarted, JSTool was in the menu. So maybe you just need to try again.

    Also, your download box says plugin version 1.2001.1, but when I downloaded from NPP 8.1.9.1, it downloaded plugin version 1.2107.2 … I don’t know if maybe the developer of that plugin got rid of the old version when they released the new version… but maybe it’s not downloading the old version correctly. If so, maybe you could download the newest zipfile directly and unzip the JSMinNPP.dll into c:\program files\Notepad++\Plugins\JSMinNPP\JSMinNPP.dll and restart Notepad++ yourself.

  • Massive empty whitespace ?

    5
    0 Votes
    5 Posts
    345 Views
    EkopalypseE

    :-) rather a dimly lit candle :-D

  • Column Sort plugin; NppColumnSort-1.0.0.2

    8
    0 Votes
    8 Posts
    1k Views
    Michael VincentM

    @brendan-ford said in Column Sort plugin; NppColumnSort-1.0.0.2:

    error that says cant run a 32 bit plugin.

    You can’t on 64-bit. Download the correct plugin version:

    https://github.com/blumu/NppColumnSort/releases/tag/1.0.0.2-64bits

    Cheers.

  • Date Time (customized)

    5
  • "Monitor with Notepad++" windows explorer context menu

    3
    0 Votes
    3 Posts
    1k Views
    elazar cohenE

    @peterjones Sorry about that.
    For anyone who’s interested, there is already a feature-request for it here https://github.com/notepad-plus-plus/notepad-plus-plus/issues/10562.

  • Direction In Find

    5
    0 Votes
    5 Posts
    999 Views
    Courtland GentryC

    @Alan-Kilborn Thank you very much this helped a lot.

  • Show tab as a displayed character

    4
    0 Votes
    4 Posts
    10k Views
    Alan KilbornA

    @marc-wilson

    Well, you can set that up, for a given language, here:

    d47c739b-465a-43f6-8fa4-ba0db7fd0675-image.png

  • javascript doesn't work on notepad

    3
    0 Votes
    3 Posts
    403 Views
    marc wilsonM

    @lelez-cz If you type that into NP++, you’re just creating a file with some JS code in it. You’re not executing it.

  • Directory as Workspace repeats files

    2
    0 Votes
    2 Posts
    249 Views
    PeterJonesP

    @david-boarman ,

    I only recently started using Folder as Workspace, but I haven’t seen that. When I have launched an external process which affects the files in the folder that’s viewed in FaW panel (compiler or similar), I can see a brief flicker as it creates then deletes temporary files… but I’ve never seen it show multiple copies of the same file in the FaW list.

    However, Code::Blocks is more than a compiler; from what I remember when I played around with it a few years ago, it’s an IDE (editor+debugger) which references a compiler (and you can actually choose between different compilers at installation time or through configurations or something). But as an IDE with powerful editor features, maybe something that it is doing is interfering with the way that Notepad++ tries to monitor the folder. I’m not sure how well you’re going to be able to mix NPP and C::B.

    But it might be that some of the Settings > Preferences > MISC page will help – specifically, the File Status Auto-Detection. But folder contents aren’t the same as file contents, so maybe those settings won’t affect it.

  • ctrl+shift+f & macro

    4
    0 Votes
    4 Posts
    381 Views
    nick klausN

    @neil-schipper thanks for the reply.
    many files [actually .m3u music playlists]
    I’m removing tracks I no longer own from .m3u history lists.

    yes I mean 1000’s of strings.
    They should be windows paths in 99% of cases but can’t rule out something being not strictly windows.

    Your method sounds solid, I made a AHK style c++ app to do the job, it’s slow but this is a once a year bit of house keeping so no need to be fast.

    I’ll keep your method in mind for similar smaller projects. Thanks again.

  • REGEX: Global replace column name with instance of alias in SQL

    3
    0 Votes
    3 Posts
    817 Views
    Neil SchipperN

    @wg992 I achieved the transformation of your sample data using a macro I recorded which carried out conventional editing, searching and copy/paste operations. The macro acted on a single pair of corresponding D1. rows. I then ran the macro as many times as needed.

    Note that within a macro, all of these operations are fully supported: selecting text, launching a search on that text via Ctl-F3, search again with F3, and, fresh clipboard copy/paste operations.

    Care is needed in regard to the cursor position before launching the macro, and, where the macro leaves the cursor.

    There are caveats, and your actual files may contain features that prevent this approach from being a desirable “all in one go” solution.

    For instance if a file contains a large number of separate outer level SELECT {} structures, using the simple macro I used (which worked on the first try) will be cumbersome in that you’ll have to manually position the cursor between batches of macro runs. However, a more devious macro which incorporates a regex search (for the 1st instance of D1\d\. AS following SELECT) could be devised to overcome that.