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

Extension cpp lsp #1499

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Extension cpp lsp #1499

wants to merge 3 commits into from

Conversation

Aldenysq
Copy link

@Aldenysq Aldenysq commented Dec 8, 2022

No description provided.

@petervdonovan
Copy link
Collaborator

Maven Tycho is not happy:

Error:  Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:2.6.0:compile (default-compile) on project org.lflang.diagram: Compilation failure: Compilation failure: 
Error:  /home/runner/work/lingua-franca/lingua-franca/org.lflang.diagram/src/org/lflang/diagram/lsp/CppLanguageServer.java:[14] 
Error:  	import com.fasterxml.jackson.databind.ObjectMapper;
Error:  	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error:  Access restriction: The type 'ObjectMapper' is not API (restriction on classpath entry '/home/runner/.m2/repository/p2/osgi/bundle/com.fasterxml.jackson.core.jackson-databind/2.13.2.v20220426-1653/com.fasterxml.jackson.core.jackson-databind-2.13.2.v20220426-1653.jar')

I think this makes no sense. I'm pretty sure ObjectMapper is API.

Is there a way we can exclude this code from the Tycho build? Maybe in the same way as the way we exclude Kotlin? Epoch does not use this code.

Comment on lines +31 to +36
if (!initialized) {
CppLanguageServer.init();
initialized = true;
}
return CppLanguageServer.hoverRequest(params);
// return IHoverService.EMPTY_HOVER; // Fail silently
Copy link
Collaborator

@petervdonovan petervdonovan Jan 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    try {
        if (!initialized) {
            CppLanguageServer.init();
            initialized = true;
        }
        return CppLanguageServer.hoverRequest(params);
    } catch (IndexOutOfBoundsException e) {
        return IHoverService.EMPTY_HOVER;  // Fail silently
    }

The old code which got deleted in this PR does "Fail silently," as it says, which is of course very bad. However, I want to keep it around (temporarily, until we move away from Xtext). See lf-lang/vscode-lingua-franca#63 (and the comment about the "hacky little patch") for background

Copy link
Collaborator

@petervdonovan petervdonovan Jan 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wait, never mind. If we don't use the default hover method, we don't have the IndexOutOfBoundsException from the framework, so that comment was not exactly right. But we do use the default hover method if we are not hovering over C++ code. So actually, the right thing to do is to use the old hacky thing only if we are not hovering over C++.

Edit: Actually, I should just stop talking and clarify what I mean when I have my wits about me and have read all the other code. You can disregard what I wrote.

@Aldenysq
Copy link
Author

Commit mostly works except it highly depends on a user using "lf build" all the time, but not pressing Command+S which saves a file. If a user presses Command+S, the current file that a user is working on does not produce any output anymore (I assume the issue is somewhere where the file is closed and reopened).
Also, if some src-gen directory is deleted, feature stops working.
Steps to reproduce:

  • need to install clang
  • compile the project
  • Open .lf file, it should start building once the file is open
  • Then the feature should work,
    1. try deleting src-gen files and rebuilding again
    1. try pressing command+s, in both cases it stops working.
      There is also a bug that if a user has backslash in their code, the output is not consistent, but it is due to not proper serialization when sending json request and will be fixed soon. I should also think about other special characters that might appear in code that would not properly interact with json request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants