Skip to content

Commit d4784fc

Browse files
authored
chore(compass-editor): replace autocompleter with the one from devtools-shared (#4818)
* chore(compass-editor): replace autocompleter with the one from devtools-shared * chore(compass-editor): update mongodb-constants; use types from package
1 parent 1b60150 commit d4784fc

File tree

10 files changed

+61
-246
lines changed

10 files changed

+61
-246
lines changed

package-lock.json

Lines changed: 33 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compass-aggregations/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@mongodb-js/compass-logging": "^1.1.8",
4646
"@mongodb-js/compass-utils": "^0.3.4",
4747
"@mongodb-js/explain-plan-helper": "^1.1.1",
48-
"@mongodb-js/mongodb-constants": "^0.6.0",
48+
"@mongodb-js/mongodb-constants": "^0.6.11",
4949
"@mongodb-js/mongodb-redux-common": "^2.0.10",
5050
"bson": "^5.2.0",
5151
"compass-preferences-model": "^2.12.0",
@@ -106,7 +106,7 @@
106106
"@mongodb-js/compass-logging": "^1.1.8",
107107
"@mongodb-js/compass-utils": "^0.3.4",
108108
"@mongodb-js/explain-plan-helper": "^1.1.1",
109-
"@mongodb-js/mongodb-constants": "^0.6.0",
109+
"@mongodb-js/mongodb-constants": "^0.6.11",
110110
"@mongodb-js/mongodb-redux-common": "^2.0.10",
111111
"bson": "^5.2.0",
112112
"compass-preferences-model": "^2.12.0",

packages/compass-editor/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@
7676
"@codemirror/view": "^6.7.1",
7777
"@lezer/highlight": "^1.1.3",
7878
"@mongodb-js/compass-components": "^1.12.0",
79-
"@mongodb-js/mongodb-constants": "^0.6.0",
79+
"@mongodb-js/mongodb-constants": "^0.6.11",
8080
"polished": "^4.2.2",
81-
"prettier": "^2.7.1",
82-
"semver": "^7.5.4"
81+
"prettier": "^2.7.1"
8382
}
8483
}

packages/compass-editor/src/autocompleter.test.ts

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { expect } from 'chai';
2-
import type { Completion } from './autocompleter';
3-
import { wrapField } from './autocompleter';
42
import { completer } from './autocompleter';
53

64
describe('completer', function () {
7-
const simpleCompletions: Completion[] = [
5+
const simpleCompletions = [
86
{ value: 'foo', version: '0.0.0', meta: 'stage' },
97
{ value: 'Foo', version: '0.0.0', meta: 'stage' },
108
{ value: 'bar', version: '1.0.0', meta: 'accumulator' },
@@ -67,27 +65,4 @@ describe('completer', function () {
6765
{ value: 'bar', description: 'Int32' },
6866
]);
6967
});
70-
71-
describe('wrapField', function () {
72-
it('should leave identifier as-is if its roughly valid', function () {
73-
expect(wrapField('foo')).to.eq('foo');
74-
expect(wrapField('bar_buz')).to.eq('bar_buz');
75-
expect(wrapField('$something')).to.eq('$something');
76-
expect(wrapField('_or_other')).to.eq('_or_other');
77-
expect(wrapField('number1')).to.eq('number1');
78-
});
79-
80-
it("should wrap field in quotes when it's rougly not a valid js identifier", function () {
81-
expect(wrapField('123foobar')).to.eq('"123foobar"');
82-
expect(wrapField('bar@buz')).to.eq('"bar@buz"');
83-
expect(wrapField('foo bar')).to.eq('"foo bar"');
84-
expect(wrapField('with.a.dot')).to.eq('"with.a.dot"');
85-
expect(wrapField('bla; process.exit(1); var foo')).to.eq(
86-
'"bla; process.exit(1); var foo"'
87-
);
88-
expect(wrapField('quotes"in"the"middle')).to.eq(
89-
'"quotes\\"in\\"the\\"middle"'
90-
);
91-
});
92-
});
9368
});

0 commit comments

Comments
 (0)