BBx-Kitchen / bbj-language-server

BBj Language Server
MIT License
6 stars 6 forks source link

initialization takes a lot of time #111

Closed StephanWald closed 4 weeks ago

StephanWald commented 11 months ago

When loading the first program the VSCode plugin, it scans all BBj classpath entries plus the PREFIX. You can observe that in the "Output" view for BBj. We'll need something to persist the result of this scanning inside the project, and/or speed that process up, so Code Completion etc. appears quicker.

dhuebner commented 10 months ago

@StephanWald Is it possible for you to try out the state of this PR build? https://github.com/BBx-Kitchen/bbj-language-server/actions/runs/6640875808

The completion should be available earlier now.

dhuebner commented 10 months ago

@StephanWald I have one more additional improvement committed. See latest build for https://github.com/BBx-Kitchen/bbj-language-server/pull/114

StephanWald commented 10 months ago

I can confirm that the delay until CC works is now much shorter, more towards the acceptable side now....

dhuebner commented 10 months ago

Merged to master

ndecker-basis commented 10 months ago

I'm still seeing lengthy initialization lines, particularly with the Outline. With the attached file, the Outline shows "Loading document symbols for 'OutlineProblem.bbj'..." for a very long time. The fastest it has completed was ~ 15 seconds, but it often takes 60 seconds or more to finally display the Outline. I attached a sample program that demonstrates the issue.

In case it helps, here's my prefix:

PREFIX "/Users/ndecker/Documents/EclipseBBjWorkspace/" "/Users/ndecker/Documents/EclipseBBjWorkspace/InternalProductionDemos/classes/" "/Users/ndecker/Documents/EclipseBBjWorkspace/utilities/dashboard/" "/Users/ndecker/Programming/Git Projects/" "/Users/ndecker/Programming/Git Projects/bbjcalendarwidget/" "/Users/ndecker/Programming/Git Projects/PluginManager/" "/Users/ndecker/Documents/EclipseBBjWorkspace/utilities/" "/opt/basis/bbjsp/src/" "/Users/ndecker/Documents/EclipseBBjWorkspace/utilities/launchdock/" "/Users/ndecker/Documents/EclipseBBjWorkspace/utilities/reporting/bbjasper/" "/Users/ndecker/Documents/EclipseBBjWorkspace/utilities/translations/" "/Users/ndecker/Documents/EclipseBBjWorkspace/utilities/email/" /opt/basis/utils/bwu/ "/Users/ndecker/Documents/EclipseBBjWorkspace/utilities/gapps/" "/Users/ndecker/Documents/EclipseBBjWorkspace/utilities/admin/" "/Users/ndecker/Documents/EclipseBBjWorkspace/utilities/xcall/" "/Users/ndecker/Documents/EclipseBBjWorkspace/utilities/DialogWizard/" "/Users/ndecker/Documents/EclipseBBjWorkspace/utilities/BBjToJavadoc/" "/Users/ndecker/Documents/EclipseBBjWorkspace/demos/Common/" "/Users/ndecker/Documents/EclipseBBjWorkspace/demos/chiledd/" "/Users/ndecker/Documents/EclipseBBjWorkspace/demos/AdminAPI/" "/opt/basis/plugins/" "/opt/basis/perfanalyzer/" "/opt/basis/utils/std/" "/opt/basis/lib/" "/opt/basis/BBJSPApps/chile/" "/opt/basis/cache/bbjsp/bbjsp/" "/opt/basis/utils/" "/opt/basis/utils/gappsV3/"

Here's my classpath: basis.classpath.bbj_default=(bbj_internal)\:/opt/basis/jars/jsoup-latest.jar\:/opt/basis/jars/json-latest.jar\:/opt/basis/jars/opencsv-3.4.jar\:/opt/basis/jars/jaudiotagger-2.2.6-SNAPSHOT.jar\:/opt/basis/demos/Fonts/demofonts.jar\:/opt/basis/demos/demoslaunchdockClientFiles.jar\:/opt/basis/demos/Jars/YahooFinanceAPI-2.3.0.jar\:/opt/basis/lib/BBjDocsGenerator.jar\:/opt/basis/jars/xmpcore-6.1.11.jar\:/opt/basis/jars/metadata-extractor-2.18.0.jar

Here's the program file: OutlineProblem.bbj.zip

dhuebner commented 10 months ago

@ndecker-basis Thanks for reporting! I doubt the OutlineProblem.bbj file is the problem, it is not big enough. I think it is more the amount of referenced Java libraries and maybe BBj projects you referencing. I've prepared a new commit that improves the handling of JavaClass scope. I also added some additional logging to the BBj output that can probably help to understand where the time is spend during start-up.

@StephanWald Could you also try out the current state and check the Output log?

dhuebner commented 10 months ago

@ndecker-basis ... one more note. Your imports like use java.time.Instant; rem some comment are now also resolved correctly.

ndecker-basis commented 10 months ago

You were correct about the OutlineProblem.bbj file not being the issue. I thought that it must be due to something else since Stephan's results were very good with that program file and it was pretty short. Originally I didn't know how to see the output from the language server, but now I know that I can select 'BBj' from the dropdown and view the log. After looking at the output, the timing issue appears to be due to having too many directories/files loaded in the current workspace.

When I originally created my VS Code workspace, I added my old Eclipse workspace directory. I didn't think about that folder again, as I haven't accessed it in VS Code, but I saw over 500 lines in the Output saying: Skipped binary file from index: [Old_Eclipse_Workspace_Path]...

That folder is not really necessary to have in my VS Code workspace, so I just removed it. After doing that, the Outline displays pretty much instantly!

Thanks for taking care of this so promptly!

dhuebner commented 4 weeks ago

Resolved