-
-
Notifications
You must be signed in to change notification settings - Fork 30
feat: workspace folders #18
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
Open
doorgan
wants to merge
27
commits into
main
Choose a base branch
from
doorgan/multiroot_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
83c901b
Support multiple root projects
doorgan 3ba3c91
Use saner parent_path? implementation and add tests
doorgan 63ceee1
Merge main
doorgan 3582869
Start projects dynamically
doorgan c0c879a
Fix credo issue
doorgan 74a24fb
Merge remote-tracking branch 'origin/main' into doorgan/multiroot_sup…
doorgan c0aa69b
Merge remote-tracking branch 'origin/main' into doorgan/multiroot_sup…
doorgan cf379a5
chore: use lsp workspace folder functionality
doorgan b4b54a8
fix: support the case where the root folder contains subprojects
doorgan 5f32c6a
Merge remote-tracking branch 'origin/main' into doorgan/multiroot_sup…
doorgan 90ab70a
chore: add tests
doorgan d6279f4
fix: use GenLSP logging utility
doorgan e25b98b
chore: remove leftover code
doorgan 962b351
Merge remote-tracking branch 'origin/main' into doorgan/multiroot_sup…
doorgan 3fa0ea4
chore: remove tests from new fixture projects
doorgan a4370d5
fix: prevent tests from randomly not running
doorgan 88e884b
fix: fix flaky test
doorgan 9aa0ca7
Merge remote-tracking branch 'origin/main' into doorgan/multiroot_sup…
doorgan 3b1dfba
Merge remote-tracking branch 'origin/main' into doorgan/multiroot_sup…
doorgan 51ebda9
Merge remote-tracking branch 'origin/main' into doorgan/multiroot_sup…
doorgan 1cf3bd9
fix: fallback to heuristics if workspace_folders is not set
doorgan 04968a1
fix: remove heuristics and just default to no workspace folders
doorgan 7e342cb
fix: try to start projects in a task
doorgan a3201f2
chore: format
doorgan 4c812a6
Merge remote-tracking branch 'origin/main' into doorgan/multiroot_sup…
doorgan 1092e9f
Merge remote-tracking branch 'origin/main' into doorgan/multiroot_sup…
doorgan e32c101
Merge remote-tracking branch 'origin/main' into doorgan/multiroot_sup…
doorgan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,5 +20,3 @@ if Code.ensure_loaded?(LoggerFileBackend) do | |
else | ||
:ok | ||
end | ||
|
||
require Logger |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
defmodule Expert.ActiveProjects do | ||
@moduledoc """ | ||
A cache to keep track of active projects. | ||
|
||
Since GenLSP events happen asynchronously, we use an ets table to keep track of | ||
them and avoid race conditions when we try to update the list of active projects. | ||
""" | ||
|
||
use GenServer | ||
|
||
def child_spec(_) do | ||
%{ | ||
id: __MODULE__, | ||
start: {__MODULE__, :start_link, []} | ||
} | ||
end | ||
|
||
def start_link do | ||
GenServer.start_link(__MODULE__, [], name: __MODULE__) | ||
end | ||
|
||
def init(_) do | ||
__MODULE__ = :ets.new(__MODULE__, [:set, :named_table, :public, read_concurrency: true]) | ||
{:ok, nil} | ||
end | ||
|
||
def projects do | ||
__MODULE__ | ||
|> :ets.tab2list() | ||
|> Enum.map(fn {_, project} -> project end) | ||
end | ||
|
||
def add_projects(new_projects) when is_list(new_projects) do | ||
for new_project <- new_projects do | ||
# We use `:ets.insert_new/2` to avoid overwriting the cached project's entropy | ||
:ets.insert_new(__MODULE__, {new_project.root_uri, new_project}) | ||
end | ||
end | ||
|
||
def remove_projects(removed_projects) when is_list(removed_projects) do | ||
for removed_project <- removed_projects do | ||
:ets.delete(__MODULE__, removed_project.root_uri) | ||
end | ||
end | ||
|
||
def set_projects(new_projects) when is_list(new_projects) do | ||
:ets.delete_all_objects(__MODULE__) | ||
add_projects(new_projects) | ||
end | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.