Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Fix preloading of files from code fixes on Windows #377

Merged
merged 3 commits into from
Oct 24, 2017

Conversation

tomv564
Copy link
Contributor

@tomv564 tomv564 commented Oct 22, 2017

For #370, where getConfiguration now takes windows paths.
The paths from typescript need to be converted from forward slashes back to windows paths.
Small fix, do you want a test or discuss normalised paths?

@codecov
Copy link

codecov bot commented Oct 24, 2017

Codecov Report

Merging #377 into master will decrease coverage by 0.01%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #377      +/-   ##
==========================================
- Coverage   74.63%   74.61%   -0.02%     
==========================================
  Files          15       15              
  Lines        1762     1765       +3     
  Branches      332      333       +1     
==========================================
+ Hits         1315     1317       +2     
  Misses        296      296              
- Partials      151      152       +1
Impacted Files Coverage Δ
src/typescript-service.ts 72.89% <75%> (-0.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2391d4a...967f9bd. Read the comment docs.

@@ -1245,7 +1245,9 @@ export class TypeScriptService {

return this.projectManager.ensureOwnFiles(span)
.concat(Observable.defer(() => {
const configuration = this.projectManager.getConfiguration(fileTextChanges[0].fileName)
// Configuration lookup uses Windows paths, FileTextChanges uses unix paths. Convert to backslashes.
const firstChangedFile = uri2path(path2uri(fileTextChanges[0].fileName))
Copy link
Contributor

@felixfbecker felixfbecker Oct 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the purpose of this is to convert to backslashes, why not simply do filename.replace(/\//g, '\\')? Converting to a URI and back seems like a hack

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that the intention is to only do it if it's a path with a drive letter, I'd still prefer to leave the URI functions out of this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's not the cleanest looking solution :) I'll extract the needed logic from uri2path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@felixfbecker felixfbecker merged commit 1c4fe3a into sourcegraph:master Oct 24, 2017
@tomv564 tomv564 deleted the fix-code-actions-on-windows branch October 24, 2017 22:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants