CudaText icon indicating copy to clipboard operation
CudaText copied to clipboard

LSP plugin: black decor icons (happens with some files drag-n-dropped from File Explorer)

Open veksha opened this issue 3 years ago • 27 comments
trafficstars

black decor icons (happens with some files drag-n-dropped from File Explorer) Windows OS.

attaching file Input.zip

to reproduce: EDIT: - set this option in cuda_lsp config: 'lint_type': 'd'

  • drag-and-drop attached file from file explorer. you must have clangd configured to make it show decor icons

image

veksha avatar Aug 31 '22 15:08 veksha

if I close and reopen same file from inside Cud, icons will be drawn FINE. EDIT: not always

veksha avatar Aug 31 '22 15:08 veksha

ImageList initing is missed. let's try this: formmain_py_api.inc

        DECOR_SET:
          begin
            if not Ed.Strings.IsIndexValid(NLine) then
              exit(ReturnFalse);

             ////ADD this---->
            if Ed.ImagesGutterDecor=nil then
              Ed.ImagesGutterDecor:= TImageList.Create(Ed);  

Alexey-T avatar Aug 31 '22 15:08 Alexey-T

added. they are not black now, but still invisible:

https://user-images.githubusercontent.com/275333/187717945-5672b7fd-3c2f-483e-af64-e430ccaf2c02.mp4

veksha avatar Aug 31 '22 15:08 veksha

now on Win10. have Py 3.9.6 installed, and did install of LSP pip install python-lsp-server . pylsp.exe runs Ok.

by LSP server don't work at all in app! I use Cud x32, coz IDE is also x32. Console: LSP: starting server - Python; root: None

Alexey-T avatar Aug 31 '22 15:08 Alexey-T

somehow ImageList is recreated and looses all icons. i want to repro this and then i want to put breakpoint in IDE to lazarus/lcl/include/imglist.inc

procedure TCustomImageList.Clear;

which is called somehow. I will see 'stack trace' window and see from where its called.

Alexey-T avatar Aug 31 '22 15:08 Alexey-T

LSP server don't work at all in app! I use Cud x32,

32bit works ok.

LSP: starting server - Python; root: None

image

veksha avatar Aug 31 '22 16:08 veksha

Maybe permissions problem (admin account?), or antivirus.

veksha avatar Aug 31 '22 16:08 veksha

can you see the bug also on this simple plug? I dont. on drag-drop from Win10 explorer decor icons are ok.

cuda_tst_acp_ic.zip

can this tst plug be changed to make repro?

Alexey-T avatar Aug 31 '22 18:08 Alexey-T

custom icons are ok:

https://user-images.githubusercontent.com/275333/187758552-8ab331a3-5161-4eb7-acf8-3d5c2c07070e.mp4

can this tst plug be changed to make repro?

I don't know what to change 🤔

veksha avatar Aug 31 '22 18:08 veksha

clangd LSP, sample C file

#include <stdio.h>

int main(int argc, char *argv[])
{
  printf("Hello.\n");
  return 0;
}

and its copy (modified). drag-drop from Win10 explorer - no repro! tried with 2 groups too.

Alexey-T avatar Aug 31 '22 19:08 Alexey-T

veksha, can you see 'stack trace' for this Clear call? set breakpoint only before drag-drop! https://github.com/Alexey-T/CudaText/issues/4327#issuecomment-1233127630

Alexey-T avatar Aug 31 '22 19:08 Alexey-T

have you tried drag-n-dropping file I attached? Input.zip

veksha avatar Aug 31 '22 19:08 veksha

tried this .h file now - 5 tries, no repro :(

Alexey-T avatar Aug 31 '22 19:08 Alexey-T

this breakpoint is not hit on drag-n-drop, but bug is there

image

veksha avatar Aug 31 '22 19:08 veksha

I will try to repro on 2nd Win10 PC (very old) later.

Alexey-T avatar Aug 31 '22 19:08 Alexey-T

on clean cuda there is no bug. hmm.

veksha avatar Aug 31 '22 19:08 veksha

let's find the culprit plugin or opt?

Alexey-T avatar Aug 31 '22 19:08 Alexey-T

yes. trying now.

veksha avatar Aug 31 '22 19:08 veksha

maybe 'lint_type' value ('d' or 'b') is important?

Alexey-T avatar Aug 31 '22 19:08 Alexey-T

i have repro witjh 'lint_type': 'd' !

Alexey-T avatar Aug 31 '22 19:08 Alexey-T

I have no repro without this key

veksha avatar Aug 31 '22 19:08 veksha

found that its NOT Cud bug. its LSP plg bug. I added print('imglist fill1') near 1st place where i found imagelist_proc() call. and added 2nd print near 2nd place of imagelist_proc call. when i see black icons - console does not print anything! (if I clear console before drag-drop)

also - when icons ok, i see FOUR prints! its bad

Alexey-T avatar Aug 31 '22 20:08 Alexey-T

so 4 calls of imagelist_proc or zero. but it should be 1.

Alexey-T avatar Aug 31 '22 20:08 Alexey-T

what if you remove 'lint_type': 'd' text completely from config? how many calls then?

veksha avatar Aug 31 '22 20:08 veksha

then 0.

Alexey-T avatar Aug 31 '22 20:08 Alexey-T

oh, it defaults to 'b' (bookmarks)

veksha avatar Aug 31 '22 20:08 veksha

can we find out, which plg function (contailing call to initing imagelist) is not called in the 'bad case'?

Alexey-T avatar Sep 07 '22 14:09 Alexey-T

can be closed?

veksha avatar Sep 30 '22 07:09 veksha