-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup serverstate and project (#187)
* Hide ServerState data members * Store only one collection of projects * Collapse Project data members into RebuildIndex * Dont read from disk multiple times When loading a project, SmithyFiles were being read from disk multiple times. This commit refactors ProjectLoader to only read from disk once, and also cleans up some stuff. * Add interface for getting managed files Project loading can now depend on a single interface that provides access to managed files, rather than ServerState itself. * Add documentation to new methods * Rename DocumentLifecycleManager * Cleanup some of Project's api * Get rid of extraneous Document methods
- Loading branch information
1 parent
224bc64
commit 1e48800
Showing
26 changed files
with
904 additions
and
1,228 deletions.
There are no files selected for viewing
This file contains 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 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
23 changes: 23 additions & 0 deletions
23
src/main/java/software/amazon/smithy/lsp/ManagedFiles.java
This file contains 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,23 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package software.amazon.smithy.lsp; | ||
|
||
import software.amazon.smithy.lsp.document.Document; | ||
|
||
/** | ||
* Provides access to {@link Document}s managed by the server. | ||
* | ||
* <p>A document is _managed_ if its state is controlled by the lifecycle methods | ||
* didOpen, didClose, didChange, didSave. In other words, reading from disk _may_ | ||
* not provide the accurate file content. | ||
*/ | ||
public interface ManagedFiles { | ||
/** | ||
* @param uri Uri of the document to get | ||
* @return The document if found and it is managed, otherwise {@code null} | ||
*/ | ||
Document getManagedDocument(String uri); | ||
} |
This file contains 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.