[Top][All Lists]

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

Re: CC Mode and electric-pair "problem".

From: Clément Pit-Claudel
Subject: Re: CC Mode and electric-pair "problem".
Date: Mon, 18 Jun 2018 23:52:57 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 2018-06-18 21:48, Stefan Monnier wrote:
> 1- Make sure the programmer is aware there's a problem in its code.
>    I.e. highlight the opening quote or the non-escaped end-of-line or
>    something in bright red or something like that.

Agreed.  Given this criterion, the patch is an improvement: making sure that 
lines past the first one are not highlighted suppresses the risk of misleading 
the programmer into thinking that they have a multiline-string.

(This happens to me from time to time in Python, actually: I write "abc
def" instead of """abc
def""", and the highlighting doesn't immediately reveal the error.  Simply not 
highlighting the second line would help a lot.

> 2- Don't try to guess what the user intended to do.
>    Instead keep our code as simple as possible: the C code we're handed
>    is broken, so there's no real clear "right behavior" anyway.

I'm not sure whether we can afford to bail out like that — for people who don't 
use some form of structured editing, most of the code that the IDE ends up 
seeing is broken in some way (unmatched { or ", incomplete declarations, 
incorrect numbers of arguments, undeclared identifiers, etc.)

Modeling our error recovery behaviors on the one used by relevant compilers 
seems like a pretty good approach (ultimately, for the modes I maintain, I'd 
like to delegate fontification to a language server provided by the compiler).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]