bug of SourceEditorManagerIntf.GetHighlighterSettings lazarus / 9-Editor ---------------------------------------------------------------------- Guva · 2021-01-27 17:04 Hello everyone. faced syntax highlighting problem when using TsynPasSyn component. For example, if you use: SourceEditorManagerIntf.GetEditorControlSettings (FCodeText); SourceEditorManagerIntf.GetHighlighterSettings (SynCPP); then everything works as it should. But if you use TsynPasSyn then neither GetEditorControlSettings nor GetHighlighterSettings work. Can anyone come across this and is there a solution? reproducing the error https://youtu.be/VeqASvj6IzE ---------------------------------------------------------------------- Martin_fr · 2021-01-27 18:33 How/where is the variable "SynPas" created? Is the code you use public? Where can it be downloaded? Or do you have a complete example, that can reproduce the issue? ---------------------------------------------------------------------- Guva · 2021-01-27 18:40 Quote from: Martin_fr on January 27, 2021, 07:33:00 pmHow/where is the variable "SynPas" created? Is the code you use public? Where can it be downloaded? Or do you have a complete example, that can reproduce the issue? https://github.com/GuvaCode/Code-Librarian ---------------------------------------------------------------------- Martin_fr · 2021-01-27 20:02 I found the problem. But I do not yet have a solution. GetHighlighterSettings expects a highlighter of the following class for Pascal: TIDESynFreePasSyn TIDESynPasSyn But both of those classes are defined in the IDE code. So your code cannot access them. (Defining your own will not work, it is not the name. It is the exact type). Not sure yet how much work it will be to fix that. More later..... ---------------------------------------------------------------------- Martin_fr · 2021-01-27 20:23 Btw, if I select "code librarian" from menu, the window is created partly out of the screen. This seems to be caused by poMainFormCenter The main form is the IDE-main-bar (with the menu, and component palette). I don't use anchordocking, and my ide-main-bar is on the top of the screen. Since your form's height is bigger that that of the IDE-main-bar, the code move the new top of your form to be higher than that of the ide-main-bar => and that new top is outside the screen. --- I have no idea if the current LCL behaviour is any good as it is (or if it should be improved). => new different topic. ---------------------------------------------------------------------- Martin_fr · 2021-01-27 21:08 OK, I committed a "fix".... https://github.com/User4martin/lazarus/commit/6ea4b2d11331b0b96e1abb99 bebaf33ea1cfde9e https://github.com/User4martin/lazarus/commit/6ea4b2d11331b0b96e1abb99 bebaf33ea1cfde9e.diff Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses IDEOptEditorIntf, EditorSyntaxHighlighterDef;...var SynPas: TSynCustomHighlighter;begin  SynPas := TSynCustomHighlighter(IDEEditor Options.CreateSynHighlighter(lshFreePascal)); That means you cannot create the highlighter as component on the form. You have to create it in your code. Currently lshFreePascal returns a sub-class of TSynPasSyn. However, that is not guaranteed. All you can trust is that it is a TSynCustomHighlighter. CreateSynHighlighter will also apply the current settings. CreateSynHighlighter returns TObject. But that is only because I did not want IdeIntf to depend on SynEdit. ---------------------------------------------------------------------- Guva · 2021-01-28 14:50 Quote from: Martin_fr on January 27, 2021, 10:08:02 pmOK, I committed a "fix".... https://github.com/User4martin/lazarus/commit/6ea4b2d11331b0b96e1abb99 bebaf33ea1cfde9e https://github.com/User4martin/lazarus/commit/6ea4b2d11331b0b96e1abb99 bebaf33ea1cfde9e.diff Thanks. Everything works on the trunk ..