Re: [gedit-list] GtkSourceView



On Wed, Jun 08, 2016 at 09:05:39AM +0200, Stefan Salewski wrote:
Another minor problem:

Nim has, as Haskell and Python, indent based syntax. For example we
have a type section

type
  Name: string
  Color: int
  
or

while i >= 0:
  sum = sum + i
  inc(i)

Blocks/sections end when indendt decreases again, so there is no end or
} marker. The problem is, that most people use 2 spaces for an indent
step, but some may use only one or maybe 3. It would be nice if the
syntax highlighting knows the correct user desired indent size, so
maybe when 2 spaces are the desired step size, it can display the line
in red when indent step is odd. Related is a visible indent help -- I
used two spaces width bars left to the indent area which helps the eye
to see block termination. All that works fine for fixed index size.

Do you have an idea how it may also work for user defined indent sizes?

It would be easy when single tabs would be used for indentation -- I
myself would prefer tabs, but majority of users and Nim developers do
not.

I would suggest not implementing this in the *.lang file. A *.lang file
is not a magical solution where you can implement all sort of features
that need a parser. Normally the syntax requires just a scanner (i.e.
tokenizer), but with GtkSourceView it's more powerful since you can have
nested contexts (so it's between a scanner and parser, it's not as
powerful as a real parser implemented in a compiler).

--
Sébastien


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]