• Login
Community
  • Login

Auto Language detection via Hint

Scheduled Pinned Locked Moved General Discussion
2 Posts 2 Posters 3.9k 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.
  • A
    AJ Baxter
    last edited by Nov 29, 2015, 4:18 AM

    is there some feature for detecting the language settings to choice NOT based on file extension?

    i want something like… scan the first 3 lines, and look for a specific string marker and then parse it for a language identifier

    eg. in C languages
    /*
    n+±lang: .C
    */

    1 Reply Last reply Reply Quote 0
    • C
      Claudia Frank
      last edited by Nov 30, 2015, 11:18 PM

      Hi AJ Baxter,

      what you can do is writing a python script which can do it.
      Something like

      for i in range(1,3):
          identifier = editor.getLine(i)
          if identifier == 'something to compare':
              notepad.setLangType(LANGTYPE.CPP)
              ...
      

      If you know how it can be identified and you are willing to go this way let me know.
      Btw. what needs to be done, reagrding python script plugin installation and creation
      of script can you read here .

      Cheers
      Claudia

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