codefori / vscode-rpgle

RPGLE language tools for VS Code
MIT License
39 stars 18 forks source link

Strange behavior of data structure subfields name autocompletion #308

Closed allthom closed 4 months ago

allthom commented 5 months ago

Hi everybody, i am here to tell you about a strange thing happening on my pcs. I'have defined a DS like this:

Dcl-DS Prats Qualified Inz;
  prid packed(13:0);
  pridrac packed(13:0);
  dataPag date;
  dataVal date;
  gimocr zoned(6:0);
  gimolnd zoned(6:0);
  spese packed(11:2);
  diarie packed(11:2);
  totale packed(11:2);
  codAcgL char(6);
  cognome char(35);
  nome char(35);
  codAcgC Char(6);
End-DS;

Then in source when i try to write DS subfields name i get the autocompletition (see below) prats1

but if I put the name of the DS inside round brackets, I lose the suggestion of the names of the fields of the DS prats2


Context Version
Code for IBM i version 2.8.0
Visual Studio Code version 1.87.2
Operating System win32_x64
Active extensions ``` COBOL (cobol): 10.3.25 Code for IBM i Walkthroughs (vscode-ibmi-walkthroughs): 0.4.0 Db2 for IBM i (vscode-db2i): 0.9.0 ESLint (vscode-eslint): 2.4.4 Emmet (emmet): 1.0.0 Error Lens (errorlens): 3.16.0 Git (git): 1.0.0 Git Base (git-base): 1.0.0 GitHub (github): 0.0.1 IBM i Notebooks (vscode-ibmi-notebooks): 0.0.6 JSON Language Features (json-language-features): 1.0.0 Merge Conflict (merge-conflict): 1.0.0 Node Debug Auto-attach (debug-auto-launch): 1.0.0 RPGLE (vscode-rpgle): 0.26.3 TODO Highlight (vscode-todo-highlight): 1.0.5 TypeScript and JavaScript Language Features (typescript-language-features): 1.0.0 WSL (remote-wsl): 0.86.0 ```

Remote system |Setting|Value| |-|-| |IBM i OS|V7R3M0| |Tech Refresh|12| |CCSID|65535| |Default CCSID|280| |SQL|Disabled |Source dates|Disabled ### Enabled features |/usr/bin|/QSYS.lib/ILEDITOR.lib|/QSYS.LIB| |-|-|-| |attr|GENCMDXML.PGM|QZDFMDB2.PGM| |iconv|GETNEWLIBL.PGM|| |ls||| |setccsid||| |tar|||
Shell env ```bash ```
Variants ```json { "american": "#@$", "local": "��$" } ```
Errors ```json [ { "command": "/QOpenSys/usr/bin/qsh", "code": 1, "stderr": "CPC9801: Oggetto MXCMD2RUN di tipo *DTAQ creato nella libreria QTEMP.\nCPC9801: Oggetto MXRSNDMG di tipo *DTAQ creato nella libreria QTEMP.\nCPF2111: La libreria ILEDITOR esiste gi�.", "cwd": "/home/MYUSER" }, { "command": "/QOpenSys/usr/bin/qsh", "code": 1, "stderr": "CPFA0A9: L'oggetto non � stato trovato. L'oggetto � /QSYS.LIB/MYUSER.LIB/VSCODE.FILE/RPGLINT.MBR.\nCPFA097: Oggetto non copiato. L'oggetto � /QSYS.LIB/MYUSER.LIB/VSCODE.FILE/RPGLINT.MBR.", "cwd": "/home/MYUSER" }, { "command": "export BUILDLIB=\"QGPL\" && export CURLIB=\"QGPL\" && export USERNAME=\"MYUSER\" && export HOST=\"172.22.46.4\" && export HOME=\"/home/MYUSER\" && export WORKDIR=\"/home/MYUSER\" && export LIBLS=\"MYUSER plus a very long library list QTEMP\" && env", "code": 1, "stderr": "bsh: BUILDLIB=QGPL: is not an identifier", "cwd": "/home/MYUSER" } ] ```
worksofliam commented 5 months ago

@allthom Do you have 'format on save' enabled? I am looking into this.

worksofliam commented 5 months ago

I have tried to recreate with no luck. Perhaps a video, or share the entire document/file where this is happening.

allthom commented 5 months ago

@worksofliam thx for your reply, any suggestion on how to make a video? Where do i have to look for the 'format on save' option? Anyway it happens on all my sources, sources are stored as pf-src member.

angelorpa commented 4 months ago

I have tried to recreate with no luck. Perhaps a video, or share the entire document/file where this is happening.

@worksofliam check this video clip. My option "format on save" is disabled but it should be irrelevant. When you write the data structure name inside parenthesis when open parenthesis is in the same line you lose the autocomplete suggestions for field names. Sames happens whit enums.

https://github.com/codefori/vscode-rpgle/assets/10833316/44f68190-cf2c-4902-8ede-30364518934e

worksofliam commented 4 months ago

@angelorpa Your issue actually looks different from the original issue but nonetheless interesting find. Thanks

lgiammattei commented 4 months ago

@worksofliam I noticed another "strange" behavior of the autocomplete function, again with DS. Let's say we defined a procedure block with dcl-proc; and end-proc; something like this immagine if I start writing the name of the ds inside the dcl-proc block; / end-proc; doesn't solve it for me, look at the picture immagine if instead I insert it into another block of code, perhaps an if or a do within the dcl-proc;/end-proc; it is resolved immagine immagine immagine Sorry for the many images but from my devlopment pc i am unable to record a video

worksofliam commented 4 months ago

@angelorpa and @lgiammattei

I have fixed your issues and released them in 0.26.4.

angelorpa commented 4 months ago

now It's working like a champ. Thanks.

lgiammattei commented 4 months ago

@worksofliam thank you, I'm sorry but it seem there is another issue with scoping. I have this procedure long more than a couple hundreds lines of code. I have ds defined with LIKEDS keyword immagine at line 193 it solve the names of the variables immagine at line 194 it looses the scope immagine :-( what's wrong with my sources? and after line 194 it doesn't resolve any other variable name i defined in the source itself also the IsIban indicator is not resolved for content assist immagine it worked at line 185 but not at line 195

worksofliam commented 4 months ago

@lgiammattei are you able to share the source with me? I'd like to be able to debug this.

lgiammattei commented 4 months ago

@worksofliam the source itself is on a non public server, how can I share it with you? add a txt file to this thread?

worksofliam commented 4 months ago

@lgiammattei yes, sharing a txt file is good. GitHub Gist is also fine.

lgiammattei commented 4 months ago

@worksofliam here we go XXAA3604.TXT I've noticed, after line 198 it does not resolve, but after line 207 it solve it back, what a mess :-(

worksofliam commented 4 months ago

Can you share your definition of DSAnagraficaArbitri from your copybook?

I created a temp one like this, and I am not having issues - so I believe it's just an issue when coming from the copybook - shouldn't be an issue.

**free
dcl-ds DSAnagraficaArbitri qualified;
  Matricola char(1);
  Cognome char(35);
  Nome char(35);
  CodiceFiscale char(16);
  Localita char(35);
  Indirizzo char(35);
  CAP char(9);
  IBAN char(27);
  DataNascita char(10);
  LuogoNascita char(35);
  ProvinciaNascita char(2);
  Nazionalita char(2);
  Sesso char(1);
  Telefono char(14);
  Cellulare char(14);
  Email char(50);
end-ds;
image image
lgiammattei commented 4 months ago

@worksofliam

Dcl-DS DSAnagraficaArbitri  TEMPLATE QUALIFIED;
  Matricola Zoned(7:0);
  Cognome Char(35);
  Nome Char(35);
  CodiceFiscale Char(16);
  Indirizzo Char(35);
  Localita Char(25);
  Provincia Char(2);
  CAP Char(9);
  IBAN Char(27);
  CRA Char(2);
  Sezione Char(3);
end-ds;