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

Milestone 1 #39

Merged
merged 93 commits into from
Mar 2, 2020
Merged

Milestone 1 #39

merged 93 commits into from
Mar 2, 2020

Conversation

Prince781
Copy link
Member

@Prince781 Prince781 commented Aug 31, 2019

Implemented member access completion (edit) and basically everything else from Milestone 1. This requires some changes in valac to work properly, which I have yet to complete.

@taozuhong

This comment has been minimized.

@benwaffle
Copy link
Member

I haven't read the code in depth, but some general thoughts

  1. can we get the necessary valac changes into master? is it already there? (there was one commit that allowed the compiler to continue despite failures)
  2. Let's not keep any logic in protocol.vala. I want to keep the models untouched. This will also help with Autogenerate LSP definitions #27 later.
  3. I'm going to split up main.vala into multiple files (Waiting for this PR to merge because it's large). Can you put the completion stuff in completion.vala?

@Prince781
Copy link
Member Author

  1. There are more changes needed in valac. There is a feature to continue semantic analysis after syntax failures, but the grammar needs to be changed to facilitate this. I haven't worked on this yet.
  2. Seeing as Autogenerate LSP definitions #27 is very far off, for simplicity I'd like to keep it (there's very little logic - most is just setting default values). We can change this later.
  3. Sure, but I'd prefer to do that after the merge.

@benwaffle
Copy link
Member

benwaffle commented Oct 13, 2019

  1. what are these grammar changes
  2. ill do it once this is merged
  3. Ok

@Prince781
Copy link
Member Author

Prince781 commented Dec 22, 2019

The latest commit fails because I'm relying on my version of Vala with LSP mode changes.

@Prince781
Copy link
Member Author

Prince781 commented Dec 24, 2019

Here's basically the status of where I am on this PR w.r.t. completion:

Namespace.$                             (done)
    - complete member if we're not completing a class

Expression.$                            (done)
    - complete member of Expression

Function($                              (signature help)
    - complete local/global variables in 0'th position of function argument

Function(Expression,$                   (signature help)
    - complete in i'th position of function argument

new [ObjectCreationExpression] ([arguments]) { $
    - look for members of [Object]

When every case is marked (done) or something like (signature help) and my commits to vala are accepted, then this PR is ready.

edit: These other cases are context-sensitive so they'll be reserved for Milestone 2:

Namespace.[member] = $
Expression.[member] = $
    - look for local variables in scope with same type

Expression.[member] = new $
    - look for constructors with same type

@Prince781
Copy link
Member Author

I also added some basic hover support, which will need to be improved later in a different PR. There are also some performance issues I'll need to work on in another PR.

@Prince781 Prince781 force-pushed the wip/completion branch 2 times, most recently from 7b423be to aa78661 Compare December 26, 2019 07:01
@Prince781
Copy link
Member Author

It's actually a bit hard to do completion for symbol<$ because of ambiguity with binary expressions with '<'. I'll leave that for a later date.

@Prince781
Copy link
Member Author

Prince781 commented Dec 28, 2019

How to test out this branch in three five easy steps:

  1. clone https://gitlab.gnome.org/Prince781/vala
  2. switch to wip/lsp, build it, and install in /usr/local (this is by default, so you won't have to configure anything, just run ./autogen.sh and make)
  3. in vala-language-server, run rm -rf build/ and then configure the meson build with the libvala in /usr/local as follows:
env PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" meson build
  1. Build it with ninja -C build and create a wrapper in the main directory called vls-wrapper:
#!/bin/sh

export LD_LIBRARY_PATH=/usr/local/lib
exec $(dirname $0)/build/vala-language-server "$@"
  1. Back in vala-code, change line 21 in client.ts to:
let serverModule = context.asAbsolutePath(path.join('vala-language-server', 'vls-wrapper'/*'build', 'vala-language-server'*/))

@Prince781
Copy link
Member Author

Obviously I've taken some inspiration from philippejer in the latest commit.

@Prince781
Copy link
Member Author

I've left dependency resolution in the build system rewrite for another time.

@Prince781 Prince781 marked this pull request as ready for review January 9, 2020 03:17
find_symbol.vala Outdated Show resolved Hide resolved
find_symbol.vala Show resolved Hide resolved
find_symbol.vala Show resolved Hide resolved
list_symbols.vala Show resolved Hide resolved
main.vala Show resolved Hide resolved
main.vala Outdated Show resolved Hide resolved
main.vala Outdated Show resolved Hide resolved
main.vala Show resolved Hide resolved
projects/buildtarget.vala Show resolved Hide resolved
@Prince781
Copy link
Member Author

Prince781 commented Jan 9, 2020 via email

@Prince781
Copy link
Member Author

It looks like this is broken in libvala-0.48. I'll see what I can do later.

@Prince781 Prince781 force-pushed the wip/completion branch 3 times, most recently from 719ca1c to 709ef20 Compare January 9, 2020 17:29
@Prince781
Copy link
Member Author

I will merge this commit only after the language server changes in upstream Vala have been finalized.

@Prince781 Prince781 force-pushed the wip/completion branch 4 times, most recently from 0a96404 to b9eeed4 Compare January 9, 2020 21:42
Requires upstream changes to Vala.GirParser in order to work
We'll rely on fixes in upstream from now on
1. Introduce Vls.TestClient, which will be used for testing VLS.
2. Handle signals gracefully (SIGTERM, SIGINT)
3. Small fixes:
    3a. Vls.Compilation.compile() won't run if the compilation is empty.
        This saves some time during server initialization.
    3b. Base Vls.Server off of GLib.Object so that we can debug references
        more effectively with tools like gobject-list.
    3c. Remove/destroy GSources during server shutdown
        [Vls.Server.shutdown_real()]. This helps clear references to the
        server after shutdown.
    3d. Don't invaliate compilations on textDocument/didOpen, unless the
        sent content differs from the document content.
    3e. Improve placement of debugging messages.
4. As Vls.GirDocumentation is experimental and may break without certain
   bleeding-edge changes, add an option to compile without it (see
   meson_options.txt). This also aids debugging reference counting
   problems by reducing the amount of noise in the trace.
5. Move some common functionality to util.vala
Support cases where a project may define two or more targets that
include the same file. In this case, we create a HashTable to keep track
of the list of duplicate files (that aren't automatically added) for
each URI and each TextDocument is capable of synchronizing all of its
"clones."
Hide unstable features or features currently not supported in libvala
master:
- Disable GIR documentation
- Disable active parameter for signatureHelp
@benwaffle
Copy link
Member

Lit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature
Projects
None yet
4 participants