Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Remove normalizeFilename function - #13147

Merged
zaggino merged 2 commits into
adobe:masterfrom
ficristo:tern-fix
Mar 6, 2017
Merged

zaggino merged 2 commits into
adobe:masterfrom
ficristo:tern-fix

Conversation

@ficristo

@ficristo ficristo commented Mar 3, 2017

Copy link
Copy Markdown
Collaborator

Quick hack for #12744, I doubt this is the correct way to fix.
I am only interested to see if this could solve the crashes people are experiencing.

/cc @zaggino

@zaggino

zaggino commented Mar 3, 2017

Copy link
Copy Markdown
Contributor

This construct

var fileName = fileInfo.name;
if (ternServer.projectDir && fileName.indexOf(ternServer.projectDir) === -1) {
  fileName = ternServer.projectDir + fileName;
}

repeats itself if I have counted right and not missed any difference 5 times over the diff, perhaps

function getNormalizedFilename(fileInfo, ternServer) {
  return ...
}

and use var fileName = getNormalizedFilename(fileInfo, ternServer); would be a bit nicer

@ficristo

ficristo commented Mar 3, 2017

Copy link
Copy Markdown
Collaborator Author

Sure! If this fixes the crashes I'll refactor like that.

@zaggino

zaggino commented Mar 3, 2017

Copy link
Copy Markdown
Contributor

Anyway, were you able to replicate anything, or is this just a hinch? If it doesn't break any tests I think we could merge this for time being as #11948 doesn't seem to be moving much...

@ficristo

ficristo commented Mar 3, 2017 •

Copy link
Copy Markdown
Collaborator Author

Since people reported crashes in 1.8 that weren't in 1.7, this is the only thing that comes to my mind.
So yes, this is only an hinch...
The tests pass.

@zaggino

zaggino commented Mar 3, 2017

Copy link
Copy Markdown
Contributor

I have a project which, while working on it, definitely crashes Brackets, but I can't replicate this. Sometimes after 5 minutes, sometimes after an hour. So it'd vote the approach of merging it and seeing if there's any change in the reports.

@zaggino zaggino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

refactor before merge

@ficristo

ficristo commented Mar 4, 2017

Copy link
Copy Markdown
Collaborator Author

Refactored. After running tests again, they are quite flaky. But I'm not sure if it is because our testsuite or because my PR...

function handlePrimePump(path) {
var fileInfo = createEmptyUpdate(path),
var fileName = path;
if (ternServer.projectDir && fileName.indexOf(ternServer.projectDir) === 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if you don't mind one last change, for future readability, I'd extract this to _getDenormalizedFilename as this basically reverts _getNormalizedFilename if I'm not mistaken

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

@zaggino

zaggino commented Mar 6, 2017

Copy link
Copy Markdown
Contributor

Hi @ficristo , I've run the tests and they all pass on my machine so that thing is fine.
Just one minor thing (commented above) and I'd merge this if nobody doesn't want to add anything.

@zaggino
zaggino merged commit 9a60020 into adobe:master Mar 6, 2017
@zaggino

zaggino commented Mar 6, 2017

Copy link
Copy Markdown
Contributor

👍

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