Esempio n. 1
0
 def testCanBeCompared(self):
     with tempfile.TemporaryDirectory () as tmp:
         f = os.path.join (tmp, 'foo.fsproj')
         touch (f)
         fs_project_1 = FSharpProjectFile.from_path(f)
         fs_project_2 = FSharpProjectFile.from_path(f)
         self.assertEquals(fs_project_1, fs_project_2)
Esempio n. 2
0
 def refresh(self, fs_file):
     assert isinstance(fs_file, FSharpFile), 'wrong argument: %s' % fs_file
     # todo: run in alternate thread
     if not self.project_file:
         self.project_file = FSharpProjectFile.from_path(fs_file.path)
         return
     if not self.project_file.governs(fs_file.path):
         new_project_file = FSharpProjectFile.from_path(fs_file.path)
         self.project_file = new_project_file
     self.set_project()
Esempio n. 3
0
    def refresh(self, fs_file):
        assert isinstance(fs_file, FSharpFile), 'wrong argument: %s' % fs_file
        # todo: run in alternate thread

        if not self.project_file:
            self.project_file = FSharpProjectFile.from_path(fs_file.path)
            self.set_project()
            return

        if not self.project_file.governs(fs_file.path):
            new_project_file = FSharpProjectFile.from_path(fs_file.path)
            self.project_file = new_project_file
            self.set_project()
            return
Esempio n. 4
0
 def test_governs_SameLevel(self):
     with tempfile.TemporaryDirectory () as tmp:
         f = os.path.join (tmp, 'foo.fsproj')
         f2 = os.path.join (tmp, 'foo.fs')
         touch (f)
         touch (f2)
         fs_proj = FSharpProjectFile.from_path(f)
         self.assertTrue(fs_proj.governs (f2))
    def update_project_data(self, fs_file):
        assert isinstance(fs_file, FileInfo), 'wrong argument: %s' % fs_file
        # todo: run in alternate thread

        # fsautocomplete.exe doesn't link F# script files to any .fsproj file,
        # so bail out.
        if fs_file.is_fsharp_script_file:
            return

        if not self.project_file or not self.project_file.governs(fs_file.path):
            self.project_file = FSharpProjectFile.from_path(fs_file.path)

            if not self.project_file:
                _logger.info('could not find a .fsproj file for %s' % fs_file)
                return

            # fsautocomplete.exe takes care of managing .fsproj files, so we
            # can add as many as we need.
            self.set_project()
    def update_project_data(self, fs_file):
        assert isinstance(fs_file, FileInfo), 'wrong argument: %s' % fs_file
        # todo: run in alternate thread

        # fsautocomplete.exe doesn't link F# script files to any .fsproj file,
        # so bail out.
        if fs_file.is_fsharp_script_file:
            return

        if not self.project_file or not self.project_file.governs(
                fs_file.path):
            self.project_file = FSharpProjectFile.from_path(fs_file.path)

            if not self.project_file:
                _logger.info('could not find a .fsproj file for %s' % fs_file)
                return

            # fsautocomplete.exe takes care of managing .fsproj files, so we
            # can add as many as we need.
            self.set_project()
Esempio n. 7
0
 def testCanReturnParent(self):
     with tempfile.TemporaryDirectory () as tmp:
         f = os.path.join (tmp, 'foo.fsproj')
         touch (f)
         fs_project = FSharpProjectFile.from_path(f)
         self.assertEquals(fs_project.parent, tmp)
Esempio n. 8
0
 def testCanCreateFromPath(self):
     with tempfile.TemporaryDirectory () as tmp:
         f = os.path.join (tmp, 'foo.fsproj')
         touch (f)
         fs_project = FSharpProjectFile.from_path(f)
         self.assertEquals(fs_project.path, f)