ui: scope names in snippet titles
* added title for snippets * title displays name of parent scope. * when new TokenLocationFiles are created in the storage they are now returned as shared_ptr to ensure correct linking in the contained data. * Storage::getTokenLocationsForLinesInFile() now always returns pairs of start and end locations. * Adjusted code snippet view to regard the change described above.
This commit is contained in:
@@ -7,7 +7,7 @@ CodeView::CodeSnippetParams::CodeSnippetParams()
|
||||
: startLineNumber(0)
|
||||
, endLineNumber(0)
|
||||
, lineCount(0)
|
||||
, locationFile("")
|
||||
, locationFile(std::make_shared<TokenLocationFile>(""))
|
||||
, isActive(false)
|
||||
, isDeclaration(false)
|
||||
{
|
||||
@@ -40,8 +40,8 @@ bool CodeView::CodeSnippetParams::sort(const CodeSnippetParams& a, const CodeSni
|
||||
return false;
|
||||
}
|
||||
|
||||
const FilePath& aFilePath = a.locationFile.getFilePath();
|
||||
const FilePath& bFilePath = b.locationFile.getFilePath();
|
||||
const FilePath& aFilePath = a.locationFile->getFilePath();
|
||||
const FilePath& bFilePath = b.locationFile->getFilePath();
|
||||
|
||||
// different files
|
||||
if (aFilePath != bFilePath)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef CODE_VIEW_H
|
||||
#define CODE_VIEW_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "component/view/View.h"
|
||||
#include "data/location/TokenLocationFile.h"
|
||||
#include "utility/types.h"
|
||||
@@ -21,9 +23,10 @@ public:
|
||||
uint endLineNumber;
|
||||
uint lineCount;
|
||||
|
||||
std::string title;
|
||||
std::string code;
|
||||
|
||||
TokenLocationFile locationFile;
|
||||
std::shared_ptr<TokenLocationFile> locationFile;
|
||||
|
||||
bool isActive;
|
||||
bool isDeclaration;
|
||||
|
||||
Reference in New Issue
Block a user