Skip to content

Commit

Permalink
Hotfix for non-existent include
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavlo Malynin committed Apr 12, 2015
1 parent 3fb55f8 commit dfe3744
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions code/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,28 @@ def rescan(self):

if split[0].casefold().startswith("%include".casefold()) and self.view.file_name() is not None:
print("Scope extension")
#try:

fstart = split[1].index('"')
fend = split[1].rindex('"')
fName = split[1][fstart+1:fend]
fName = os.path.join(os.path.dirname(self._fileName), fName)
if fName in contexts:
# Awesome, we have the file
print("Added to includes")
self.includes.add(fName)
contexts[fName].ensureFresh()
else:
# We have to load it
newView = sublime.active_window().find_open_file(fName)
if newView is None:
scanRequests.add(fName)
sublime.active_window().open_file(fName)
if os.path.isfile(fName):
if fName in contexts:
# Awesome, we have the file
print("Added to includes")
self.includes.add(fName)
contexts[fName].ensureFresh()
else:
context = Context(newView)
context.rescan()
self.includes.add(fName)
#except:
# too bad
# pass
# We have to load it
newView = sublime.active_window().find_open_file(fName)
if newView is None:
scanRequests.add(fName)
sublime.active_window().open_file(fName)
else:
context = Context(newView)
context.rescan()
self.includes.add(fName)


# figure out how much we skipped, if any.
lskip = fullLine.index(split[0])
Expand Down

0 comments on commit dfe3744

Please sign in to comment.