• Login
Community
  • Login

Updated Autocomplete for Python 3

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 4 Posters 4.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N
    Noah Black
    last edited by Nov 11, 2019, 2:18 AM

    I’ve been using NPP as my Python editor ever since I started learning it. I first learned Python 2.7, and NPP has support for Python 2.7’s syntax, and hints on what functions do when I typing them (like telling me what parameters I need). This was all very helpful when learning, and is something I still appreciate.

    However, I have recently updated to Python 3.7, and there are some changes between these versions. NPP still gives me suggestions as though I’m using Python 2.7, even though I don’t even have it installed on my computer anymore.

    This is best seen when getting user input. In Python 2.7, input() was a function that would only accept and return integers as input, and raw_input() was a function that would accept any input because it would be returned as a string.
    In Python 3.7, there is no such function as raw_input(). It was removed, and now input() uses strings instead of integers.
    However, NPP still tells me that input() returns an integer (in a round-a-bout sort of way) and that a function called raw_input() exists and returns a string.

    How do I make NPP give suggestions for Python 3 instead of Python 2?

    A 1 Reply Last reply Nov 11, 2019, 7:22 PM Reply Quote 0
    • E
      Ekopalypse
      last edited by Nov 11, 2019, 1:54 PM

      The autoComplete files are available within autoCompletion directory.
      The file you are looking for is called python.xml.
      In addition you might add/change the langs.xml file, or in case you use a theme different to default theme the THEME_NAME.xml from theme directory, in order to get the new keywords.
      Note, adding keywords can also be done by using the gui
      Settings->Style Configurator->Language(Python)->Style(KEYWORDS)

      1 Reply Last reply Reply Quote 1
      • P
        PeterJones
        last edited by Nov 11, 2019, 2:27 PM

        @Ekopalypse gave a good starting place. If you’d like more details, see the Notepad++ UserManaual , especially:

        • auto-completion
        • langs.xml details
        • themes.xml details and the themes overview
        1 Reply Last reply Reply Quote 1
        • A
          Alan Kilborn @Noah Black
          last edited by Nov 11, 2019, 7:22 PM

          @Noah-Black

          There was also a recent issue filed regarding this: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6259 “Fix keywords list according to Python 3”

          1 Reply Last reply Reply Quote 1
          3 out of 4
          • First post
            3/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors