Skip to content

Auto Completion in Notepad2

Zufu Liu edited this page Feb 8, 2022 · 42 revisions

Auto Completion in Notepad2

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 need some 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 need some improvements, see TODO below.
  7. Backticks, auto insert ` after typing `.
  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 match 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" or "Auto completion is case insensitive.".

Context-Based Auto Completion

  1. Only list preprocessor directives after the starting character, that is # in most languages.
  2. Only list Objective C/C++ keywords, Java/Kotlin annotations, Julia macros, Python decorators, Cobra directives after @.
  3. Only list HTML and XML tags after < or </.
  4. Only list LaTex and Texinfo commands after \.
  5. Only list Java, Kotlin and PHP document comment tags after @.
  6. Only list Doxygen document tags after @ or \.
  7. Only list C# document comment tags after <.
  8. Only list variables in Makefile, Perl, PHP, Ruby, TCL, etc. after $.

LaTeX Input Method

Convert LaTeX-like abbreviations into Unicode characters on pressing Tab, e.g., \sum to ∑, \:smile: to 😄.

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.