microsoft / microsoft/TypeScript-Sublime-Plugin

AttributeError: 'NoneType' object has no attribute 'endswith'

Open
#507 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.