forked from haskell/haskell-language-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3944 extend the properties api to better support nested configuration (…
…haskell#3952) The implementation closely aligns with the original design, extensively incorporating existing code to minimize workload costs. The new API maintains a consistent style with the old API, which remains unchanged. Features With new expose stuff: `KeyNamePath` -- path to search for properties `definePropertiesProperty` -- define nested property `usePropertyByPath` -- extract property by path `usePropertyByPathEither` -- same as above `usePropertyByPathAction` -- action api for `usePropertyByPath` `HasPropertyByPath` -- constraint for using `usePropertyByPath` like the `HasProperty` We can now define properties upon properties to create nested one. And use KeyNamePath to retrieve the property ``` nestedPropertiesExample = emptyProperties & definePropertiesProperty #parent "parent" (emptyProperties & defineStringProperty #foo "foo" "foo") & defineStringProperty #baz "baz" "baz" nestedPropertiesExample2 = emptyProperties & definePropertiesProperty #parent "parent" (emptyProperties & defineStringProperty #foo "foo" "xxx") & defineStringProperty #baz "baz" "baz" examplePath1 = SingleKey #baz examplePath2 = ConsKeysPath #parent (SingleKey #foo) ``` To retrieve we can have ``` usePropertyByPathEither examplePath2 nestedPropertiesExample object ```
- Loading branch information
Showing
6 changed files
with
202 additions
and
21 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
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.