Coder Social home page Coder Social logo

npppluginlexerexample's Introduction

Lexer example C# - Notepad++ plugin

In Notepad++ the Lexer and Folder functions are used to add syntax highlighting and folding options to a text file. Syntax highlighting means displaying words or text parts in a different color so that it's easier to read, write and find errors. Folding means grouping parts of text and allowing the user to show or hide those parts using expand [+] or collapse [-] icons in the sidebar.

This is an example project that applies syntax highlighting and folding to EDIFACT data files. It is meant to show how to setup a C# project with custom Lex() and Fold() methods.

The syntax highlighting colors and keywords are based on user configuration in the EdifactLexer.xml file. This is just an example code project, it's not meant to be a full EDIFACT editor.

Custom Lexer

You can create a custom Lexer for new unsupported programming languages, data files or other structured text files. This lexer example is for data files, but technically it is very similar compared to a Lexer for source files.

Syntax highlighting rules can be the same for all files, like segment names in Edifact which can be set as keywords in Settings > Style configurator. For other types of files like character separated values, the separator character can be different per file and the user has to somehow set it at run-time.

Template Project

The goal is to create a Lexer plugin project, as a starting point or template for programming new plug-ins.

It is meant for finding out how to set it up and apply it my other plugin. Also see this forum post

See screenshot below, the plugin works and this is what the current plug-in project can do

preview screenshot

How to install

You can try the file EdifactLexer.dll. In your \Notepad++\plugins\ folder, create a new folder EdifactLexer and place the .dll file there, so:

For the 64-bit version it is the same, except the output file is in the Release-x64 folder and Notepad++ is in the .\Program Files\Notepad++\ folder.

Also copy the file EdifactLexer.xml to your .\Program Files\Notepad++\plugins\Config\ folder, this file contains the settings for the text styling.

See also

This plugin is based on the NotepadPlusPlusPluginPack.Net, with help from members of the Notepad++ development community

History

21-may-2021 - additional code
08-may-2021 - first test release

BdR©2021 Free to use - send questions or comments: Bas de Reuver - [email protected]

npppluginlexerexample's People

Contributors

bdr76 avatar ekopalypse avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

ekopalypse

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.