-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(lsp
): Language Server Protocol (LSP)
#11187
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
Draft
mmsaki
wants to merge
54
commits into
foundry-rs:master
Choose a base branch
from
mmsaki:lsp
base: master
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.
Draft
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
b7ff920
add forge lsp
mmsaki 990732d
add lsp crate
mmsaki b65969c
Merge branch 'foundry-rs:master' into lsp
mmsaki 2997735
fmt and cargo update
mmsaki e926489
add forge linting diagnostics capabilities
mmsaki c6ba04f
add testdata and tests
mmsaki 6b286b7
add neovim logs
mmsaki 3c36a29
Merge branch 'foundry-rs:master' into lsp
mmsaki 9655850
feat(lsp): refactor adds server to forge cmd
mmsaki b142c1b
Merge branch 'foundry-rs:master' into lsp
mmsaki 7cf3215
clean up lint_file method
mmsaki a18690a
fmt
mmsaki 6304f7d
Merge branch 'master' into lsp
mmsaki d2beb49
Merge branch 'foundry-rs:master' into lsp
mmsaki 7afb011
add forge build warnings & error diagnsotics
mmsaki 9767787
colapse if statement
mmsaki 71f6bc5
combine lint and build diagnostics fixes overring bug
mmsaki 1cb3197
read byte offsets for build errors
mmsaki 5207cd4
remove comment
mmsaki af9b975
ignore code size limit warning for test files
mmsaki 70c5eb3
update readme doc
mmsaki c4d35b7
add return on nvim lsp file
mmsaki bc90368
refactor code + add test for byte offsets
mmsaki cb43585
move structs
mmsaki 00a328f
fmt
mmsaki 18f5586
refactor
mmsaki 8019317
(chore): refactor method names
mmsaki 32a2be5
chore: example not using nvim-config
mmsaki 07da00f
chore: update readme
mmsaki c9ef019
use SHORT_VERSION from foundry commons
mmsaki 5987960
fix doc ci error
mmsaki 4823303
Merge branch 'foundry-rs:master' into lsp
mmsaki 0251293
disable lint on build
mmsaki 5273fea
use temp files for testing
mmsaki ef35e6f
fix reset hunk
mmsaki 8d5ca1d
feat(lsp): add gotoDeclaration and gotoDefinition
mmsaki a38fb7d
fix(lsp): track rellative file based nodes fixes broken goto definitions
mmsaki a228703
feat(lsp): add go to definition for contract inheritances
mmsaki 5cb4576
feat(lsp): add value nodes in expressions
mmsaki 0a81408
feat(lsp): add go to definition in user defined mapping structs
mmsaki 4d9310e
feat(lsp): goto definitions for conditions, trueBody and subExpressions
mmsaki 30f317e
feat(lsp): add left + right expressions, adds intialValues node
mmsaki bb919bb
feat(lsp): add event call goto, fix handles list and object parameters
mmsaki f5b8fd9
feat(lsp): fix handles arguments of array type
mmsaki dce0efa
feat(lsp): add handle for false body on ast
mmsaki cce016e
feat(lsp): add base expression + index expression ast node types
mmsaki 01f8f40
fix(lsp): fix clippy warnings
mmsaki 6226184
feat(lsp): add override nodes types
mmsaki d6413d5
chore(lsp): create helper function for pushing nodes to queue
mmsaki f701d4f
feat(lsp): add abstract and storage layout node
mmsaki 17e000d
feat(lsp): add file, literals and unitAliases
mmsaki a0f3148
Merge branch 'master' into lsp
mmsaki 0de7c43
fix(lsp): no need for abstract node
mmsaki e7f8231
chore(lsp): sort names alphabetically
mmsaki 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use clap::Parser; | ||
use eyre::Result; | ||
|
||
use forge_lsp::lsp::ForgeLsp; | ||
use tower_lsp::{LspService, Server}; | ||
use tracing::info; | ||
|
||
/// Start the Foundry Language Server Protocol (LSP) server | ||
#[derive(Clone, Debug, Parser)] | ||
pub struct LspArgs { | ||
/// See: <https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#implementationConsiderations> | ||
#[arg(long)] | ||
pub stdio: bool, | ||
} | ||
|
||
impl LspArgs { | ||
pub async fn run(self) -> Result<()> { | ||
// Start stdio LSP server | ||
info!("Starting Foundry LSP server..."); | ||
|
||
let stdin = tokio::io::stdin(); | ||
let stdout = tokio::io::stdout(); | ||
let (service, socket) = LspService::new(ForgeLsp::new); | ||
|
||
Server::new(stdin, stdout, socket).serve(service).await; | ||
|
||
info!("Foundry LSP server stopped"); | ||
|
||
Ok(()) | ||
} | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does nothing? I think stdin/stdout should be the default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn’t do anything at the moment 🤔 spec recommended to use the —stdio flag just to be explicit which transport method we use but maybe we don’t need to do it after all. I think we can remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, this is fine then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay i'll leave it as is, it'll work on both
forge lsp
andforge lsp --stdio
. I only plan on implementing stdio.