From 74653183d6f5d75d7b7eecddd84672d4efab0737 Mon Sep 17 00:00:00 2001 From: Wolmir Nemitz Date: Wed, 21 Sep 2022 17:08:15 -0300 Subject: [PATCH] Add test for file path symbols --- languageServer/src/test/definitions.test.ts | 28 ++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/languageServer/src/test/definitions.test.ts b/languageServer/src/test/definitions.test.ts index 5d24360919..57433d8195 100644 --- a/languageServer/src/test/definitions.test.ts +++ b/languageServer/src/test/definitions.test.ts @@ -1,5 +1,9 @@ import { Position, Range } from 'vscode-languageserver/node' -import { foreach_dvc_yaml, params_dvc_yaml } from './fixtures/examples/valid' +import { + foreach_dvc_yaml, + params_dvc_yaml, + vars_dvc_yaml +} from './fixtures/examples/valid' import { params } from './fixtures/params' import { requestDefinitions } from './utils/requestDefinitions' import { openTheseFilesAndNotifyServer } from './utils/openTheseFilesAndNotifyServer' @@ -69,4 +73,26 @@ describe('textDocument/definitions', () => { uri: 'file:///dvc.yaml' }) }) + + it('should provide a single location that points to the top of the file path symbol', async () => { + const [dvcYaml] = await openTheseFilesAndNotifyServer([ + { + languageId: 'yaml', + mockContents: vars_dvc_yaml, + mockPath: 'dvc.yaml' + }, + { + languageId: 'json', + mockContents: '', + mockPath: 'params.json' + } + ]) + const response = await requestDefinitions(dvcYaml, 'params.json') + + expect(response).toBeTruthy() + expect(response).toStrictEqual({ + range: Range.create(Position.create(0, 0), Position.create(0, 0)), + uri: 'file:///params.json' + }) + }) })