Skip to content

Commit

Permalink
try and account for windows path separators
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed Jan 31, 2023
1 parent cc3104e commit 47b45f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion languageServer/src/LanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class LanguageServer {
) {
for (const possibleFile of symbolUnderCursor.name.split(' ')) {
const possiblePath = URI.parse(
join(dirname(document.uri), possibleFile)
join(dirname(document.uri), ...possibleFile.split('/'))
).toString()
const file = await connection.sendRequest<{
contents: string
Expand Down
5 changes: 3 additions & 2 deletions languageServer/src/test/definitions.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { join } from 'path'
import { Position, Range } from 'vscode-languageserver/node'
import { URI } from 'vscode-uri'
import { params_dvc_yaml, train_dvc_yaml } from './fixtures/examples/valid'
Expand Down Expand Up @@ -59,7 +60,7 @@ describe('textDocument/definitions', () => {
})

it('should try to read the file system when a python file is unknown', async () => {
const trainUri = URI.file('train.py').toString()
const trainUri = URI.file(join(__dirname, 'train.py')).toString()

mockedReadFileContents.mockImplementation(path => {
if (path === trainUri) {
Expand All @@ -72,7 +73,7 @@ describe('textDocument/definitions', () => {
{
languageId: 'yaml',
mockContents: train_dvc_yaml,
mockPath: 'dvc.yaml'
mockPath: join(__dirname, 'dvc.yaml')
}
])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { URI } from 'vscode-uri'
import { client } from './setup-test-connections'

export const openTheseFilesAndNotifyServer = async (
files: Array<{ mockPath: string; mockContents: string; languageId: string }>
files: { mockPath: string; mockContents: string; languageId: string }[]
) => {
const filesToReturn: TextDocument[] = []

Expand Down

0 comments on commit 47b45f2

Please sign in to comment.