Skip to content

Commit c867835

Browse files
committed
chore: tabs to spaces in readme
1 parent b4c328b commit c867835

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ Ex:-
1313

1414
```lua
1515
self.client.request('workspace/executeCommand', cmd_info, function(err, res)
16-
if err then
17-
log.error(command .. ' failed! arguments: ', arguments, ' error: ', err)
18-
else
19-
log.debug(command .. ' success! response: ', res)
20-
end
16+
if err then
17+
log.error(command .. ' failed! arguments: ', arguments, ' error: ', err)
18+
else
19+
log.debug(command .. ' success! response: ', res)
20+
end
2121
end, buffer)
2222
```
2323

@@ -33,14 +33,14 @@ Assume following is the asynchronous API
3333

3434
```lua
3535
local function lsp_request(callback)
36-
local timer = vim.loop.new_timer()
36+
local timer = vim.loop.new_timer()
3737

38-
assert(timer)
38+
assert(timer)
3939

40-
timer:start(2000, 0, function()
41-
-- First parameter is the error
42-
callback('something went wrong', nil)
43-
end)
40+
timer:start(2000, 0, function()
41+
-- First parameter is the error
42+
callback('something went wrong', nil)
43+
end)
4444
end
4545
```
4646

@@ -52,7 +52,7 @@ This is how you can call this asynchronous API without a callback
5252
local M = require('sync')
5353

5454
M.sync(function()
55-
local response = M.wait_handle_error(M.wrap(lsp_request)())
55+
local response = M.wait_handle_error(M.wrap(lsp_request)())
5656
end).run()
5757
```
5858

@@ -62,9 +62,9 @@ Result:
6262
Error executing luv callback:
6363
test6.lua:43: unhandled error test6.lua:105: something went wrong
6464
stack traceback:
65-
[C]: in function 'error'
66-
test6.lua:43: in function 'callback'
67-
test6.lua:130: in function <test6.lua:129>
65+
[C]: in function 'error'
66+
test6.lua:43: in function 'callback'
67+
test6.lua:130: in function <test6.lua:129>
6868
```
6969

7070
### When error handler is defined
@@ -73,12 +73,12 @@ stack traceback:
7373
local M = require('sync')
7474

7575
local main = M.sync(function()
76-
local response = M.wait_handle_error(M.wrap(lsp_request)())
76+
local response = M.wait_handle_error(M.wrap(lsp_request)())
7777
end)
78-
.catch(function(err)
79-
print('error occurred ', err)
80-
end)
81-
.run()
78+
.catch(function(err)
79+
print('error occurred ', err)
80+
end)
81+
.run()
8282
```
8383

8484
Result:
@@ -93,16 +93,16 @@ error occured test6.lua:105: something went wrong
9393
local M = require('sync')
9494

9595
local nested = M.sync(function()
96-
local response = M.wait_handle_error(M.wrap(lsp_request)())
96+
local response = M.wait_handle_error(M.wrap(lsp_request)())
9797
end)
9898

9999
M.sync(function()
100-
M.wait_handle_error(nested.run)
100+
M.wait_handle_error(nested.run)
101101
end)
102-
.catch(function(err)
103-
print('parent error handler ' .. err)
104-
end)
105-
.run()
102+
.catch(function(err)
103+
print('parent error handler ' .. err)
104+
end)
105+
.run()
106106
```
107107

108108
Result:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy