Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect VSCode client to LspMopeServer #51

Closed
manuEbg opened this issue Jun 21, 2021 · 10 comments
Closed

Connect VSCode client to LspMopeServer #51

manuEbg opened this issue Jun 21, 2021 · 10 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@manuEbg
Copy link
Contributor

manuEbg commented Jun 21, 2021

The title says it all...

Following Issues might be:

  • Display Errors
  • Check Model
  • Code Completion
@manuEbg manuEbg added the enhancement New feature or request label Jun 21, 2021
@manuEbg manuEbg added this to the Prototype 3 milestone Jun 21, 2021
@manuEbg manuEbg self-assigned this Jun 21, 2021
@manuEbg
Copy link
Contributor Author

manuEbg commented Jun 21, 2021

Note: #21 (comment)

@CSchoel
Copy link
Contributor

CSchoel commented Jun 25, 2021

Please notify me, when you have done the first tests, connecting to the VS Code client as I would like to close #40 , once I can be sure that the implementation is correct. Any further problems concerning specific features should then become separate issues in MopeSWTP-SS21/vs-code-client.

@manuEbg
Copy link
Contributor Author

manuEbg commented Jun 28, 2021

I have not worked on this Issue yet.

@manuEbg
Copy link
Contributor Author

manuEbg commented Jul 3, 2021

I just connected the VsCode Client to our MopeServerJar.
This was pretty easy because i just had to follow the steps in the readme.
The only problem i had was that pressing F5 just triggered a build but didn't open another vscode window with the Extension running...
Propably because i forgot the Save Workspace As in this step:

  • Create a VS Code project that has the working copy of this repository as the only workspace folder (this is needed, because the repo contains a .vscode folder with settings that are required to test the extension). You can do this with the following steps:
    • Open a new window in VS code.
    • Select File -> Add folder to workspace ...
    • Add the folder containing this repository and save the workspace using File -> Save Workspace As ...

I then tried File -> Open Folder and selected the VsCodeClientRepo. This worked:)

After Connecting to the Server i received a Message "Hallo vom Server" and could see that the InitializationRequest was triggered.

However none of the other Commands worked.
loadModel is connected to this #85
Completion probably didn't work because our Mope Server does not publish any capabilities...

So the next Step for me is to publish some Server Capabilities.
There will be a new Issue for this (see #91)

@manuEbg
Copy link
Contributor Author

manuEbg commented Jul 4, 2021

After Publishing CompletionCapabilities, I managed to complete Something:)
Completion

However there are some Major Issues:(

  1. My "SymbolLimiter" does not work as expected because it does not stop at Whitespaces...
  2. Much bigger Problem: The Server can only read stuff from the File if it is saved. This makes Completion not very user friendly...

@manuEbg
Copy link
Contributor Author

manuEbg commented Jul 4, 2021

I think we need to implement the DidChangedTextDocument-Notification and DidOpenTextDocument-Notification to maintain some ShadowFiles for the Server.

@CSchoel
Copy link
Contributor

CSchoel commented Jul 5, 2021

Yeah, I think you are right on track with your analysis. 👍 Keep in mind that you might have to tell the client how you want to synchronize unsaved document updates.

@manuEbg
Copy link
Contributor Author

manuEbg commented Jul 7, 2021

After the Workaround or Fix #85 (comment) i was able to load a Model from VSCode.
And i was able to not load a Model but see Diagnostics:) Somehow there seems to be a LineCharacterConfusionIssue... Diagnostics

@CSchoel
Copy link
Contributor

CSchoel commented Jul 12, 2021

Can you double-check ...

  • which file is loaded by the OMC and what are its contents,
  • and what is the raw error message reported by the OMC?

On my machine, OMShell reports the following:

>> loadModel(SyntaxError); getErrorString()
false
"[/home/cslz90/Documents/Promotion/code/MoST/test/res/SyntaxError.mo:6:3-6:3:writable] Error: Missing token: SEMICOLON
Error: Failed to load package SyntaxError (default) using MODELICAPATH /usr/bin/../lib/omlibrary:/home/cslz90/.openmodelica/libraries/:/home/cslz90/Documents/Promotion/code/MoST/test/res.
"

This is what I would expect, since the error is on the first token that comes after the position where the semicolon should be (6:3).

Actually, now that I see the numbers... could it be that you just have a one-off error in your line and column indices?

@manuEbg
Copy link
Contributor Author

manuEbg commented Jul 12, 2021

You are right. The Error is in fact located in 6:3.
The Diagnostic published by the MopeServer also contains 6:3

DiagnosticLocation: /home/swtp/modelica/exampleModels/SyntaxError.mo
Diagnostics: 
Diagnostic [
  range = Range [
    start = Position [
      line = 6
      character = 3
    ]
    end = Position [
      line = 6
      character = 3
    ]
  ]
  severity = Error
  code = null
  codeDescription = null
  source = null
  message = "Error: Missing token: SEMICOLON\n"
  tags = null
  relatedInformation = null
  data = null
]

The VSCodeClient seems to increment the received Position

@manuEbg manuEbg closed this as completed Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants