Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## Summary

The **HTTP Language Server** is a language agnostic [LSP](https://microsoft.github.io/language-server-protocol/) that helps you while writing your HTTP requests and responses. At the moment it only supports hover documentation on all official status codes, but there are many features planned to be released soon.
The **HTTP Language Server** is a [LSP](https://microsoft.github.io/language-server-protocol/) that helps you while writing your HTTP codes and messages. At the moment it only supports hover documentation on all official status codes, but there are many features planned to be released soon.

In this early stages, breaking changes will occur frequently, so it's important that if want to use this server and it's extension, to use it with caution and please report any bugs that you might encounter.

Expand Down Expand Up @@ -96,6 +96,13 @@ require('lspconfig')['http_language_server'].setup({
})
```

## References

- https://www.iana.org/
- https://developer.mozilla.org/en-US/docs/Web/HTTP
- https://github.com/grahambates/m68k-lsp
- https://github.com/aca/emmet-ls

## License

HTTP Language Server is licensed under the terms of the MIT license.
Expand Down
85 changes: 2 additions & 83 deletions packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,96 +5,15 @@

## Summary

The **HTTP Language Server** is a language agnostic [LSP](https://microsoft.github.io/language-server-protocol/) that helps you while writing your HTTP requests and responses. At the moment it only supports hover documentation on all official status codes, but there are many features planned to be released soon.
The **HTTP Language Server** is a [LSP](https://microsoft.github.io/language-server-protocol/) that helps you while writing your HTTP codes and messages. At the moment it only supports hover documentation on all official status codes, but there are many features planned to be released soon.

In this early stages, breaking changes will occur frequently, so it's important that if want to use this server and it's extension, to use it with caution and please report any bugs that you might encounter.

## Development

[Issues](https://github.com/mateusabelli/http-language-server/issues) and [Pull Requests](https://github.com/mateusabelli/http-language-server/pulls) are welcome!

**Project setup**

```sh
git clone https://github.com/mateusabelli/http-language-server.git

cd http-language-server

pnpm install
```
### How to...

#### Use the monorepo

```sh
pnpm run server <cmd>
pnpm run client <cmd>

# example
pnpm run server install typescript
```

#### Run it in Visual Studio Code

After having the dependencies installed you can simply click on the **Run and Debug** menu located in your side bar. Select **Launch Client** and click **Start Debugging** or press **F5**.

> **Note**
> For simplicity of the development, the extension attach the server only to `plaintext` file formats by default.

**Add more file formats**
```javascript
// packages/client/extension.js
const clientOptions = {
documentSelector: [
{ scheme: "file", language: "plaintext" },
{ scheme: "file", language: "javascript" }, // <-- Add here
],
};

// packages/client/package.json
{
"activationEvents": [
"onLanguage:plaintext",
"onLanguage:javascript" // <-- Add here
],
}
```

#### Run it in Neovim

After having the dependencies installed you will need to have a working LSP setup in Neovim using [lspconfig](https://github.com/neovim/nvim-lspconfig). Then you will to follow lspconfig's [Contributing](https://github.com/neovim/nvim-lspconfig#contributions) guide to manually add this server configuration.

Here is the config file
`lua/lspconfig/server_configurations/http-language-server.lua`

```lua
local util = require 'lspconfig.util'

local bin_name = 'http-language-server'
local cmd = { bin_name, '--stdio' }

if vim.fn.has 'win32' == 1 then
cmd = { 'cmd.exe', '/C', bin_name, '--stdio' }
end

return {
default_config = {
cmd = cmd,
filetypes = { 'text' },
root_dir = util.find_git_ancestor,
single_file_support = true,
},
}
```

Then you can activate this server in the lua file that you use to setup all the other servers.

```lua
require('lspconfig')['http_language_server'].setup({
capabilities = capabilities,
on_attach = on_attach
})
```
Please checkout the main [README](https://github.com/mateusabelli/http-language-server) for instructions on how to set up a local development environment and how to use the monorepo.

## License

Expand Down
88 changes: 7 additions & 81 deletions packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,96 +5,22 @@

## Summary

The **HTTP Language Server** is a language agnostic [LSP](https://microsoft.github.io/language-server-protocol/) that helps you while writing your HTTP requests and responses. At the moment it only supports hover documentation on all official status codes, but there are many features planned to be released soon.
The **HTTP Language Server** is a [LSP](https://microsoft.github.io/language-server-protocol/) that helps you while writing your HTTP codes and messages. At the moment it only supports hover documentation on all official status codes, but there are many features planned to be released soon.

In this early stages, breaking changes will occur frequently, so it's important that if want to use this server and it's extension, to use it with caution and please report any bugs that you might encounter.

## Development

[Issues](https://github.com/mateusabelli/http-language-server/issues) and [Pull Requests](https://github.com/mateusabelli/http-language-server/pulls) are welcome!

**Project setup**
Please checkout the main [README](https://github.com/mateusabelli/http-language-server) for instructions on how to set up a local development environment and how to use the monorepo.

```sh
git clone https://github.com/mateusabelli/http-language-server.git
## References

cd http-language-server

pnpm install
```
### How to...

#### Use the monorepo

```sh
pnpm run server <cmd>
pnpm run client <cmd>

# example
pnpm run server install typescript
```

#### Run it in Visual Studio Code

After having the dependencies installed you can simply click on the **Run and Debug** menu located in your side bar. Select **Launch Client** and click **Start Debugging** or press **F5**.

> **Note**
> For simplicity of the development, the extension attach the server only to `plaintext` file formats by default.

**Add more file formats**
```javascript
// packages/client/extension.js
const clientOptions = {
documentSelector: [
{ scheme: "file", language: "plaintext" },
{ scheme: "file", language: "javascript" }, // <-- Add here
],
};

// packages/client/package.json
{
"activationEvents": [
"onLanguage:plaintext",
"onLanguage:javascript" // <-- Add here
],
}
```

#### Run it in Neovim

After having the dependencies installed you will need to have a working LSP setup in Neovim using [lspconfig](https://github.com/neovim/nvim-lspconfig). Then you will to follow lspconfig's [Contributing](https://github.com/neovim/nvim-lspconfig#contributions) guide to manually add this server configuration.

Here is the config file
`lua/lspconfig/server_configurations/http-language-server.lua`

```lua
local util = require 'lspconfig.util'

local bin_name = 'http-language-server'
local cmd = { bin_name, '--stdio' }

if vim.fn.has 'win32' == 1 then
cmd = { 'cmd.exe', '/C', bin_name, '--stdio' }
end

return {
default_config = {
cmd = cmd,
filetypes = { 'text' },
root_dir = util.find_git_ancestor,
single_file_support = true,
},
}
```

Then you can activate this server in the lua file that you use to setup all the other servers.

```lua
require('lspconfig')['http_language_server'].setup({
capabilities = capabilities,
on_attach = on_attach
})
```
- https://www.iana.org/
- https://developer.mozilla.org/en-US/docs/Web/HTTP
- https://github.com/grahambates/m68k-lsp
- https://github.com/aca/emmet-ls

## License

Expand Down