Skip to content

[rust] Consider using url::Url for DocumentUri and URI types - #361

Merged
Karthik Nadig (karthiknadig) merged 1 commit into
microsoft:mainfrom
39555:rust-url-type
Jun 24, 2024
Merged

Karthik Nadig (karthiknadig) merged 1 commit into
microsoft:mainfrom
39555:rust-url-type

Conversation

@39555

Copy link
Copy Markdown

Hi! Currently all URI types are represented as String, which is very uncomfortable to work with. This pr

  • adds the serde feature to url crate in Cargo.toml
  • adds use url::Url;
  • changes the rust generator to generate Url instead of String for DocumentUri and URI types

This is similar to what lsp-types crate does.

Are there any disadvantages to doing so?

@39555

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@39555

Copy link
Copy Markdown
Author

Oh, I found some relevant discussions against Url.
gluon-lang/lsp-types#284
gluon-lang/lsp-types#261
gluon-lang/lsp-types#282

So String may actually be good

@karthiknadig

Copy link
Copy Markdown
Member

Taya (@39555) Thanks for the suggestion and PR.

@karthiknadig Karthik Nadig (karthiknadig) added feature-request Request for new features or functionality labels Jun 24, 2024
@karthiknadig
Karthik Nadig (karthiknadig) merged commit 3a2e325 into microsoft:main Jun 24, 2024
Karthik Nadig (karthiknadig) pushed a commit to karthiknadig/lsprotocol that referenced this pull request Aug 7, 2024
…icrosoft#361)

Hi! Currently all URI types are represented as `String`, which is very
uncomfortable to work with. This pr
- adds the `serde` feature to `url` crate in Cargo.toml
- adds `use url::Url;`
- changes the rust generator to generate `Url` instead of `String` for
`DocumentUri` and `URI` types

This is similar to what [lsp-types](https://crates.io/crates/lsp-types)
crate does.

Are there any disadvantages to doing so?
Karthik Nadig (karthiknadig) pushed a commit that referenced this pull request Aug 12, 2024
)

Hi! Currently all URI types are represented as `String`, which is very
uncomfortable to work with. This pr
- adds the `serde` feature to `url` crate in Cargo.toml
- adds `use url::Url;`
- changes the rust generator to generate `Url` instead of `String` for
`DocumentUri` and `URI` types

This is similar to what [lsp-types](https://crates.io/crates/lsp-types)
crate does.

Are there any disadvantages to doing so?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature-request Request for new features or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants