Skip to content

Auto Completion in Notepad4

zufuliu edited this page Oct 26, 2024 · 5 revisions

Auto Completion in Notepad4

Settings

Open menu "Settings" -> "Auto Completion Settings".

Auto Completion Settings

Auto Indent Text

  1. Auto move caret to next line with same indentation after pressing Enter. If current line ends with {, [, ( or : or it starts with keywords that start a code block (such as if and function in many languages), caret in next line is indented one level more than current line, keywords that used to end the code block maybe added in third line in later case.
  2. Auto continue next line for document comment block starts with /** or /*!.

Auto Insert Text

  1. Auto close none void tag's end tag after typing start tag's >. e.g. after type > in body tag (<body>), the end tag </body> will be added after >. In some languages, this only has effects in comment and string.
  2. Auto insert space after typing , when appropriate. This needs improvements, see TODO below.

Auto Complete Braces and Quotes

  1. Parentheses, auto insert ) after typing ( when appropriate.
  2. Braces, auto insert } after typing { when appropriate.
  3. Square brackets, auto insert ] after typing [ when appropriate.
  4. Angle brackets, auto insert > after typing <, mostly when < and > are used in generics / template in C++, C#, Java, etc.
  5. Double quotes, auto insert " after typing " when " and " are used to quote string, bytes, etc.
  6. Single quotes, auto insert ' after typing ' when ' and ' are used to quote string, bytes, etc. This needs improvements, see TODO below.
  7. Backticks, auto insert ` after typing ` when appropriate.
  8. Enclose current selection by typing corresponding punctuation, see following table.
key result key result key result
( (selection) { {selection} [ [selection]
' 'selection' " "selection" ` `selection`
Ctrl + 3 '''selection''' Ctrl + 6 """selection""" Ctrl + 9 ```selection```

Auto Complete Words and Functions

Auto show word list that matches current input, not every word bundled with current scheme (keywords, types, functions, etc.) is shown, assembler instructions and registers in C/C++ and D are ignored.

When "Minimum length for number" is zero, numbers are ignored.

When "Scanning words in current document" is checked, words in current document will be scanned to find matching words. The default scanning timeout is 500 ms.

If word foo is followed by left parenthesis and foo is not a type, and not inside preprocessor line, then foo() will be listed in the auto-completion list instead of foo.

Auto Complete Words in English IME Mode Only

Modern IME in native mode (Chinese, Japanese, Korean, etc.) may let user select English words, when this option is enabled, the selected English word will NOT trigger auto-completion.

Case Insensitive Auto Completion

Check "Settings" -> "Auto Completion Ignore Case".

Context-Based Auto Completion

Only list relevant words after:

  • #: #preprocessor, #directive, #macro, etc.
  • $ or $^: $variable, $task, $^variable, etc.
  • @: @annotation, @attribute, @directive, @decorator, @command, @tag, @macro, @metadata, @variable, etc.
  • < or </: <tag> and </tag>.
  • \, \^, \:: \tag, \command, \^command, \:emoji, etc.
  • Other punctuation when word after them has special meaning in current language.

LaTeX Input Method

Convert LaTeX-like abbreviations into Unicode characters on pressing Tab, e.g., \sum to ∑, and \:smile: to 😄 when Notepad4 is built with NP2_ENABLE_LATEX_LIKE_EMOJI_INPUT set to 1.

See https://docs.julialang.org/en/v1/manual/unicode-input/ and https://github.com/iamcal/emoji-data for all supported LaTeX and emoji sequences.

TODO

  1. Improve auto insertion space after comma when comma is used as digit group sign.
  2. Improve auto insertion for single quote when it's used as apostrophe (right single quotation mark).
  3. Use contains method to match input other than starts with method, this feature is found in many modern IDEs.
  4. Support external API files like SciTE and many other editors.
  5. Use approximate string match method, the is future is found in many modern powerful IDEs.