Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

new idea: high light local variables in a function body

(1/1)

ollydbg:
I see that we have a function:

--- Code: ---void CodeCompletion::UpdateEditorSyntax(cbEditor* ed)
--- End code ---
which give a set of tokens(keywords) as member variables to scintilla control, so that it can highlight them, by

--- Code: ---    ed->GetControl()->SetKeyWords(3, keywords);
    ed->GetControl()->Colourise(0, -1);

--- End code ---

So, if we put a mouse in a function body, and let our parser parse the function body, and give scintilla control all the local variable tokens, and finally we can only highlight them inside the function body by

--- Code: ---    ed->GetControl()->SetKeyWords(3, local_variables_list);
    ed->GetControl()->Colourise(begin_of_function_body, end_of_function_body);

--- End code ---
:)

EDIT: some old similar discussion: CC based semantic highlight

oBFusCATed:
No you can't, because this is global keyword set.

This example code will break it easily:

--- Code: ---int myGlobal=5;

int myFunc() {
    int myGlobal=7;
   
    ... do something with the myGlobal...
}

--- End code ---

This feature needs to be done with a custom lexer or modifications to scintilla.

ollydbg:

--- Quote from: oBFusCATed on March 19, 2015, 09:10:46 am ---No you can't, because this is global keyword set.

This example code will break it easily:

--- Code: ---int myGlobal=5;

int myFunc() {
    int myGlobal=7;
   
    ... do something with the myGlobal...
}

--- End code ---

This feature needs to be done with a custom lexer or modifications to scintilla.

--- End quote ---
Indeed, I agree with you, so it is hard to implement this idea.

p2rkw:
https://github.com/alpha0010/ClangLib/commit/bc2e9f23a16893d699c5cf0ebbd14def294fc64d

Navigation

[0] Message Index

Go to full version