Repository: spyder-ide/spyder

Issue:
Spyder Issue when using ctrl+P : goto line 
## Description

**What steps will reproduce the problem?**

1. 
2. 
3. 

**What is the expected output? What do you see instead?**


**Please provide any additional information below**

  File "C:\Program Files\Anaconda3\lib\site-packages\spyder\widgets\fileswitcher.py", line 755, in setup
    self.setup_file_list(filter_text, current_path)
  File "C:\Program Files\Anaconda3\lib\site-packages\spyder\widgets\fileswitcher.py", line 629, in setup_file_list
    text_item += " [{0:} {1:}]".format(self.line_count[index],
AttributeError: 'FileSwitcher' object has no attribute 'line_count'


## Version and main components

* Spyder Version: 3.2.1 
* Python Version: 3.5.2
* Qt Versions: 5.6.0, PyQt5 5.6 on Windows

## Dependencies
```
pyflakes >=0.6.0 :  1.3.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.18.1 (OK)
numpy >=1.7      :  1.12.1 (OK)
sphinx >=0.6.6   :  1.4.6 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
nbconvert >=4.0  :  4.2.0 (OK)
sympy >=0.7.3    :  1.0 (OK)
cython >=0.21    :  0.24.1 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
IPython >=4.0    :  5.1.0 (OK)
pylint >=0.25    :  1.5.4 (OK)

```



Discussion:
Thanks for reporting. We'll fix this in our 3.2.2 version.
@dalthviz, please take a look at this one.

Resolving patch:
diff --git a/spyder/widgets/fileswitcher.py b/spyder/widgets/fileswitcher.py
--- a/spyder/widgets/fileswitcher.py
+++ b/spyder/widgets/fileswitcher.py
@@ -302,7 +302,14 @@ def widgets(self):
 
     @property
     def line_count(self):
-        return [widget.get_line_count() for widget in self.widgets]
+        line_count = []
+        for widget in self.widgets:
+            try:
+                current_line_count = widget[0].get_line_count()
+            except AttributeError:
+                current_line_count = 0
+            line_count.append(current_line_count)
+        return line_count
 
     @property
     def save_status(self):
@@ -609,12 +616,16 @@ def setup_file_list(self, filter_text, current_path):
         # Get optional line number
         if trying_for_line_number:
             filter_text, line_number = filter_text.split(':')
+            # Get all the available filenames
+            scores = get_search_scores('', self.filenames,
+                                       template="<b>{0}</b>")
         else:
             line_number = None
+            # Get all available filenames and get the scores for
+            # "fuzzy" matching
+            scores = get_search_scores(filter_text, self.filenames,
+                                       template="<b>{0}</b>")
 
-        # Get all available filenames and get the scores for "fuzzy" matching
-        scores = get_search_scores(filter_text, self.filenames,
-                                   template="<b>{0}</b>")
 
         # Get max width to determine if shortpaths should be used
         max_width = self.get_item_size(paths)[0]
@@ -632,7 +643,9 @@ def setup_file_list(self, filter_text, current_path):
                     text_item += u"<br><i>{0:}</i>".format(short_paths[index])
                 else:
                     text_item += u"<br><i>{0:}</i>".format(paths[index])
-                results.append((score_value, index, text_item))
+                if (trying_for_line_number and self.line_count[index] != 0 or
+                        not trying_for_line_number):
+                    results.append((score_value, index, text_item))
 
         # Sort the obtained scores and populate the list widget
         self.filtered_path = []


Test patch: