OrangeC icon indicating copy to clipboard operation
OrangeC copied to clipboard

Autocomplete + Syntax error highlighting

Open I-Tom-I opened this issue 6 years ago • 16 comments

Would it be possible to have tab-autocomplete and syntax error highlighting? It would make development much smoother with the IDE.

Once again thank you for designing such a great compiler! Amazing how there is DOS support and works on Windows 95/98 and doesn't introduce artificial incompatibility like MSVC does with its CRT.

I-Tom-I avatar Jun 01 '18 14:06 I-Tom-I

Autocomplete seems like a difficult task, it would require querying the compiler for the struct's descendant fields and then display them, but that would require a language-server like mode as well. The other thing for syntax error highlighting would be a massive amount of error changes to be more location based, with syntax only compilation etc. that would require a lot of work but I can see it being done via those methodologies.

chuggafan avatar Jun 01 '18 16:06 chuggafan

Actually it is supposed to be doing autocomplete, for structure members and for function definitions. There is a small program 'occpr' which is basically the C compiler accepting connections from the IDE over a pipe, and which writes to an SQL database. That is one of several databases OCIDE reads.

Occpr is the same program that feeds in information about symbols so the ide knows how to colorize things...

I was wondering what was up with the code completion not working the other day but there is a lot going on so I haven't had a chance to look into it. I will see what it is doing this weekend.

As far as syntax highlighting, I don't know if the present scheme would work without some modification. The occpr approach to retrieiving information about the code is kind of slow... and it would have to be modified to give feedback about errors. I was wondering what would happen if I went to some effort to pull out various C/C++ operations that just don't make sense in this context but haven't gotten there yet...

LADSoft avatar Jun 01 '18 20:06 LADSoft

In general I'd suggest to add a "syntax check only" option to occ (also: never invokes the linker) - a mode occpr would default to - actual code parts that are not needed for the simple checks would in this case be surrounded by something like

    #if !OCC_CHECK_ONLY
    if (!check_only_mode) {
        ... actual code here ...
    }
    #endif

GitMensch avatar Jun 01 '18 22:06 GitMensch

It doesn't have to have advanced stuff like parameter type checking, just the basics like mismatched parenthesis, forgotten semicolons, mismatched brackets, curly brackets would be a huge improvement. Maybe when you compile and the compiler gives a line error it could add a red squiggly line below the error line (msvc does this for certain errors intellisense doesn't detect)

I-Tom-I avatar Jun 03 '18 08:06 I-Tom-I

that doesn't sound too hard... worst of it will be drawing a little red squiggle! Meanwhile I've improved the code completion, if you don't feel like snagging it from the CI I'll have a release in a week or so whenever I get the syntax highlighting worked out.

LADSoft avatar Jun 03 '18 17:06 LADSoft

well it is not perfect but I'm open to suggestions... will try to have a release within a few days.

LADSoft avatar Jun 10 '18 03:06 LADSoft

Autocomplete still doesn't show up? I have half-typed variable = 10; I'm at variab and it should show me variable Autocomplete not showing up

I-Tom-I avatar Jun 14 '18 21:06 I-Tom-I

Is that a CI build or is that a release build? because those are two different beasts

chuggafan avatar Jun 14 '18 21:06 chuggafan

I got it from here https://ci.appveyor.com/project/LADSoft/orangec/build/job/p2eyjvjdewgk7i8j/artifacts

I-Tom-I avatar Jun 14 '18 21:06 I-Tom-I

yeah that is the CI build. I found out today that the database stuff isn't working in the CI builds... checking into that is next on my list :) I'm also cleaning up the syntax checking a little more.

LADSoft avatar Jun 15 '18 02:06 LADSoft

Hi Tom,

sorry I didn't explain better yesterday.

the 'CI' builds are completely built with the orange c toolchain itself, which means any bug anywhere in the tool chain can have adverse affects. As opposed to the versions I put on my web site, which are still built with Visual studio. This is why chuggafan said the CI builds are a whole different beast...,

in this case it appears that when the orange c compiler converted a long long to an enum, in a function argument, it generated bad code. This had adverse effects on the program that generates the database for the code completion while not affecting much of anything else. I've pushed a fix and the next CI build should work a little better.

LADSoft avatar Jun 16 '18 02:06 LADSoft

@LADSoft Do you consider this close-fixed already?

GitMensch avatar Jun 16 '18 18:06 GitMensch

I was intentionally leaving it open because I didn't know if there would be issues. I may close it since now you've opened #228... let me think about it...

LADSoft avatar Jun 17 '18 02:06 LADSoft

reopening as this needs to be completely reworked.

LADSoft avatar Aug 26 '19 20:08 LADSoft

Hi @LADSoft, is there any update on this matter? and thanks a lot for your work btw!

JakoDel avatar Feb 17 '22 18:02 JakoDel

I haven't been working on the IDE; syntax highlighting probably doesn't work so well...

LADSoft avatar Feb 21 '22 12:02 LADSoft