microsoft / microsoft/TypeScript-Sublime-Plugin
AttributeError: 'NoneType' object has no attribute 'endswith'
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 236
- Avg merge
- 21d 13h
- Merged PRs (30d)
- 1
Description
Getting this traceback:
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 377, in on_query_completions
res = callback.on_query_completions(v, prefix, locations)
File "TSCompletion in /Users/rc/Library/Application Support/Sublime Text 3/Installed Packages/TypescriptCompletion.sublime-package", line 50, in on_query_completions
File "TSCompletion in /Users/rc/Library/Application Support/Sublime Text 3/Installed Packages/TypescriptCompletion.sublime-package", line 258, in TSC_IsTypeScript
AttributeError: 'NoneType' object has no attribute 'ends with'
On line 48, is this statement:
current_file = view.file_name()
file_name() returns None and the call to the TSC_IsTypeScript(current_file) (line 50) tries to see if the filename ends with ".ts". I have an untitled file that I'm working on, so I suppose None is a valid state for the file_name to be in. As soon as I save it, it no longer has this error, this definitely an edge case.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the on_query_completions callback and trace its current_file value into TSC_IsTypeScript, using the reported lines 48 and 50 as entry points. Reproduce the problem in an untitled Sublime Text buffer, then verify that completion produces no traceback there while saved TypeScript files continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100