codemirror-languageserver 1.15.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,15 @@ This plugin enables code completion, hover tooltips, and linter functionality by
6
6
 
7
7
  [How It Works](https://hjr265.me/blog/codemirror-lsp/)
8
8
 
9
+ ## Features
10
+
11
+ https://user-images.githubusercontent.com/348107/120141150-c6bb9180-c1fd-11eb-8ada-9b7b7a1e4ade.mp4
12
+
13
+ - ⌨️ Code Completion (w/ Resolve Support)
14
+ - 📚 Hover Documentation
15
+ - 🩺 Diagnostics
16
+ - 🔍 Go to Definition, Declaration, and Type Definition
17
+
9
18
  ## Usage
10
19
 
11
20
  ```
@@ -60,8 +69,6 @@ Contributions are welcome.
60
69
 
61
70
  ## Real World Uses
62
71
 
63
- https://user-images.githubusercontent.com/348107/120141150-c6bb9180-c1fd-11eb-8ada-9b7b7a1e4ade.mp4
64
-
65
72
  - [Toph](https://toph.co): Competitive programming platform. Toph uses Language Server Plugin for CodeMirror 6 with its integrated code editor.
66
73
 
67
74
  ## License
package/demo/demo.js CHANGED
@@ -32,16 +32,37 @@ import {
32
32
  } from '@codemirror/autocomplete';
33
33
  import { lintKeymap } from '@codemirror/lint';
34
34
  import { cpp } from '@codemirror/lang-cpp';
35
- import {
36
- languageServer,
37
- jumpToDefinitionKeymap,
38
- jumpToDefinitionPos,
39
- } from '../src';
35
+ import { languageServer } from '../src';
40
36
 
41
37
  const tabSizeCompartment = new Compartment();
42
38
 
39
+ const doc = `#include <iostream>
40
+
41
+ using namespace std;
42
+
43
+ class Animal {
44
+ public:
45
+ void say(string call) {
46
+ cout << call << endl;
47
+ }
48
+ };
49
+
50
+ class Cat : Animal {
51
+ public:
52
+ void meow() {
53
+ this->say("meow");
54
+ }
55
+ };
56
+
57
+ int main() {
58
+ Cat cat;
59
+ cat.meow();
60
+ return 0;
61
+ }
62
+ `
63
+
43
64
  const view = new EditorView({
44
- doc: '#include <iostream>\n\nusing namespace std;\n\nint main() {\n\treturn 0;\n}\n',
65
+ doc,
45
66
  parent: document.getElementById('editor'),
46
67
  extensions: [
47
68
  lineNumbers(),
@@ -84,17 +105,5 @@ const view = new EditorView({
84
105
  documentUri: `file:///demo/main.cpp`,
85
106
  languageId: 'cpp',
86
107
  }),
87
- keymap.of([...jumpToDefinitionKeymap]),
88
- EditorView.domEventHandlers({
89
- click: (event, view) => {
90
- if (!event.ctrlKey && !event.metaKey) return;
91
- const pos = view.posAtCoords({
92
- x: event.clientX,
93
- y: event.clientY,
94
- });
95
- const ok = jumpToDefinitionPos(pos)(view);
96
- if (ok) event.preventDefault();
97
- },
98
- }),
99
108
  ],
100
109
  });