Skip to content

Commit 0480246

Browse files
authored
Merge pull request #19 from CodinGame/fix-README
Update readme
2 parents 08406d4 + 8f7bec5 commit 0480246

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,29 @@ npm install @codingame/monaco-languageclient-react
1010

1111
#### Simple usage
1212

13-
You just need to import and render the `LanguageClient` component:
13+
You need to create an `infrastructure` object and render the `LanguageClient` component:
1414

15-
```typescript
15+
```tsx
1616
import React from "react";
1717

18-
import LanguageClient from "@codingame/monaco-languageclient-react";
18+
import LanguageClient, { Infrastructure } from "@codingame/monaco-languageclient-react";
19+
20+
class MyInfrastructure implements Infrastructure {
21+
automaticTextDocumentUpdate = false
22+
rootUri = 'file://...'
23+
useMutualizedProxy() { return false }
24+
getFileContent(resource, languageClient) { return ... }
25+
openConnection(id) {
26+
// create connection
27+
}
28+
}
29+
const infrastructure = new MyInfrastructure()
1930

2031
function LanguageClientContainer() {
2132
return (
2233
<LanguageClient
23-
languageServerConfig={...}
24-
getSecurityToken={...}
25-
languageServerUrl={...}
34+
id='java'
35+
infrastructure={infrastructure}
2636
/>
2737
);
2838
}

0 commit comments

Comments
 (0)