Skip to content

Commit

Permalink
* fixed underlining syntax errors shows only first error
Browse files Browse the repository at this point in the history
* fixed option "Show expansions when" not saving state "writing an identifier"
* added icon for disabled project item (tool set to "None")
preparation for semantic server

git-svn-id: http://svn.dsource.org/projects/visuald/trunk@220 a09178c5-0f50-412e-aa4a-0aec1a98dccb
  • Loading branch information
sagitario committed Apr 30, 2012
1 parent 9580dde commit 17e7d3b
Show file tree
Hide file tree
Showing 15 changed files with 354 additions and 250 deletions.
5 changes: 4 additions & 1 deletion CHANGES
Expand Up @@ -404,7 +404,7 @@ Version history

unreleased Version 0.3.32

* new version of ccv2pdb with better handling of unicode characters in path names
* new version of cv2pdb with better handling of unicode characters in path names
* new version of mago with string literal support for associative array keys and easier stepping into main
* some changes to reduce memory leaks due to false pointers
* fixed parser to disambiguate MixinStatement and MixinExpression
Expand All @@ -415,3 +415,6 @@ unreleased Version 0.3.32
* fixed custom command: project would not restore if multiple commands are used
* project properties: added output type DLL for easier switching between DMD and GDC
* project properties: added subsystem option, use "not set" if you have to specify a specific windows version
* fixed underlining syntax errors shows only first error
* fixed option "Show expansions when" not saving state "writing an identifier"
* added icon for disabled project item (tool set to "None")
8 changes: 6 additions & 2 deletions vdc/parser.visualdproj
Expand Up @@ -4,6 +4,7 @@
<obj>0</obj>
<link>0</link>
<lib>1</lib>
<subsystem>0</subsystem>
<multiobj>0</multiobj>
<singleFileCompilation>0</singleFileCompilation>
<oneobj>0</oneobj>
Expand Down Expand Up @@ -99,6 +100,7 @@
<obj>0</obj>
<link>0</link>
<lib>1</lib>
<subsystem>0</subsystem>
<multiobj>0</multiobj>
<singleFileCompilation>0</singleFileCompilation>
<oneobj>0</oneobj>
Expand Down Expand Up @@ -194,6 +196,7 @@
<obj>0</obj>
<link>0</link>
<lib>0</lib>
<subsystem>0</subsystem>
<multiobj>0</multiobj>
<singleFileCompilation>0</singleFileCompilation>
<oneobj>0</oneobj>
Expand Down Expand Up @@ -233,7 +236,7 @@
<Dversion>2.043</Dversion>
<ignoreUnsupportedPragmas>0</ignoreUnsupportedPragmas>
<compiler>0</compiler>
<otherDMD>1</otherDMD>
<otherDMD>0</otherDMD>
<program>m:\s\d\rainers\windows\bin\dmd.exe</program>
<imppath>..</imppath>
<fileImppath>.</fileImppath>
Expand Down Expand Up @@ -276,7 +279,7 @@
<preBuildCommand />
<postBuildCommand />
<debugtarget>$(TargetPath)</debugtarget>
<debugarguments>m:\s\d\rainers\dmd\test\runnable\*.d</debugarguments>
<debugarguments>c:\tmp\d\runnable\*.d</debugarguments>
<debugworkingdir />
<debugattach>0</debugattach>
<debugremote />
Expand Down Expand Up @@ -316,5 +319,6 @@
<File path="parsertest.d" />
<File path="semantic.d" />
<File path="util.d" />
<File path="versions.d" />
</Folder>
</DProject>
69 changes: 1 addition & 68 deletions vdc/semantic.d
Expand Up @@ -19,6 +19,7 @@ import vdc.ast.tmpl;
import vdc.parser.engine;
import vdc.logger;
import vdc.interpret;
import vdc.versions;

import stdext.util;
import stdext.array;
Expand Down Expand Up @@ -877,74 +878,6 @@ class Options
return level <= debugIds.level;
}

__gshared int[string] predefinedVersions;

static int[string] sPredefinedVersions()
{
if(!predefinedVersions)
{
predefinedVersions =
[
"DigitalMars" : 1,
"GNU" : -1,
"LDC" : -1,
"SDC" : -1,
"D_NET" : -1,

"Windows" : 1,
"Win32" : 1,
"Win64" : -1,
"linux" : -1,
"OSX" : -1,
"FreeBSD" : -1,
"OpenBSD" : -1,
"BSD" : -1,
"Solaris" : -1,
"Posix" : -1,
"AIX" : -1,
"SkyOS" : -1,
"SysV3" : -1,
"SysV4" : -1,
"Hurd" : -1,
"Cygwin" : -1,
"MinGW" : -1,

"X86" : 1,
"X86_64" : -1,
"ARM" : -1,
"PPC" : -1,
"PPC64" : -1,
"IA64" : -1,
"MIPS" : -1,
"MIPS64" : -1,
"SPARC" : -1,
"SPARC64" : -1,
"S390" : -1,
"S390X" : -1,
"HPPA" : -1,
"HPPA64" : -1,
"SH" : -1,
"SH64" : -1,
"Alpha" : -1,

"LittleEndian" : 1,
"BigEndian" : -1,

"D_Coverage" : -1,
"D_Ddoc" : -1,
"D_InlineAsm_X86" : 1,
"D_InlineAsm_X86_64" : -1,
"D_LP64" : -1,
"D_PIC" : -1,

"D_Version2" : 1,
"none" : -1,
"all" : 1,
];
}
return predefinedVersions;
}

int versionPredefined(string ident)
{
if(ident == "unittest")
Expand Down
6 changes: 4 additions & 2 deletions vdc/vdserver.visualdproj
Expand Up @@ -4,6 +4,7 @@
<obj>0</obj>
<link>0</link>
<lib>0</lib>
<subsystem>0</subsystem>
<multiobj>0</multiobj>
<singleFileCompilation>0</singleFileCompilation>
<oneobj>0</oneobj>
Expand Down Expand Up @@ -43,7 +44,7 @@
<Dversion>2.043</Dversion>
<ignoreUnsupportedPragmas>0</ignoreUnsupportedPragmas>
<compiler>0</compiler>
<otherDMD>1</otherDMD>
<otherDMD>0</otherDMD>
<program>m:\s\d\rainers\windows\bin\dmd_msc.exe</program>
<imppath>..</imppath>
<fileImppath />
Expand Down Expand Up @@ -99,6 +100,7 @@
<obj>0</obj>
<link>0</link>
<lib>0</lib>
<subsystem>0</subsystem>
<multiobj>0</multiobj>
<singleFileCompilation>0</singleFileCompilation>
<oneobj>0</oneobj>
Expand Down Expand Up @@ -192,6 +194,6 @@
</Config>
<Folder name="vdserver">
<File path="vdserver.d" />
<File tool="Custom" path="vdserver.idl" customcmd="path %path%;c:\l\vs9\vc\bin;c:\l\vs9\common7\IDE&#10;midl /I &quot;c:\Program Files\Microsoft SDKs\Windows\v6.0A\Include&quot; /D _DEBUG /nologo /char signed /env win32 /Oicf /out $(OutDir) /error stub_data $(InputPath)" outfile="$(OutDir)/vdserver.tlb" />
<File tool="Custom" path="vdserver.idl" customcmd="path %path%;c:\l\vs9\vc\bin;c:\l\vs9\common7\IDE&#10;midl /I &quot;$(WindowsSdkDir)\Include&quot; /D _DEBUG /nologo /char signed /env win32 /Oicf /out $(OutDir) /error stub_data $(InputPath)" outfile="$(OutDir)/vdserver.tlb" />
</Folder>
</DProject>
77 changes: 77 additions & 0 deletions vdc/versions.d
@@ -0,0 +1,77 @@
// This file is part of Visual D
//
// Visual D integrates the D programming language into Visual Studio
// Copyright (c) 2010-2011 by Rainer Schuetze, All Rights Reserved
//
// License for redistribution is given by the Artistic License 2.0
// see file LICENSE for further details

module vdc.versions;

__gshared int[string] predefinedVersions;

static int[string] sPredefinedVersions()
{
if(!predefinedVersions)
{
predefinedVersions =
[
"DigitalMars" : 1,
"GNU" : -1,
"LDC" : -1,
"SDC" : -1,
"D_NET" : -1,

"Windows" : 1,
"Win32" : 1,
"Win64" : -1,
"linux" : -1,
"OSX" : -1,
"FreeBSD" : -1,
"OpenBSD" : -1,
"BSD" : -1,
"Solaris" : -1,
"Posix" : -1,
"AIX" : -1,
"SkyOS" : -1,
"SysV3" : -1,
"SysV4" : -1,
"Hurd" : -1,
"Cygwin" : -1,
"MinGW" : -1,

"X86" : 1,
"X86_64" : -1,
"ARM" : -1,
"PPC" : -1,
"PPC64" : -1,
"IA64" : -1,
"MIPS" : -1,
"MIPS64" : -1,
"SPARC" : -1,
"SPARC64" : -1,
"S390" : -1,
"S390X" : -1,
"HPPA" : -1,
"HPPA64" : -1,
"SH" : -1,
"SH64" : -1,
"Alpha" : -1,

"LittleEndian" : 1,
"BigEndian" : -1,

"D_Coverage" : -1,
"D_Ddoc" : -1,
"D_InlineAsm_X86" : 1,
"D_InlineAsm_X86_64" : -1,
"D_LP64" : -1,
"D_PIC" : -1,

"D_Version2" : 1,
"none" : -1,
"all" : 1,
];
}
return predefinedVersions;
}
Binary file modified visuald/Resources/DImageList.bmp
Binary file not shown.
11 changes: 5 additions & 6 deletions visuald/colorizer.d
Expand Up @@ -27,8 +27,7 @@ import visuald.dlangsvc;
import visuald.config;

import vdc.lexer;
import vdc.semantic;
import vdc.ast.node;
import vdc.versions;

import stdext.string;

Expand Down Expand Up @@ -299,7 +298,7 @@ class Colorizer : DisposingComObject, IVsColorizer, ConfigModifiedListener
uint pos = 0;
bool inTokenString = (Lexer.tokenStringLevel(state) > 0);

Node ast = mSource.mAST;
LanguageService langsvc = Package.GetLanguageService();
while(pos < iLength)
{
uint prevpos = pos;
Expand All @@ -313,10 +312,10 @@ class Colorizer : DisposingComObject, IVsColorizer, ConfigModifiedListener
else
span = ParserSpan(prevpos, iLine, pos, iLine);

if(ast && tok[0] == 'i')
if(tok[0] == 'i')
if(tok == "in" || tok == "is")
{
if(isBinaryOperator(ast, iLine + 1, prevpos, iLine + 1, pos))
if(langsvc.isBinaryOperator(mSource, iLine + 1, prevpos, iLine + 1, pos))
type = TokenColor.Operator;
else
type = TokenColor.Keyword;
Expand Down Expand Up @@ -557,7 +556,7 @@ class Colorizer : DisposingComObject, IVsColorizer, ConfigModifiedListener
__gshared int[wstring] predefinedVersions;
shared static this()
{
foreach(v, p; vdc.semantic.Options.sPredefinedVersions)
foreach(v, p; vdc.versions.sPredefinedVersions)
predefinedVersions[to!wstring(v)] = p;
}

Expand Down
48 changes: 6 additions & 42 deletions visuald/completion.d
Expand Up @@ -36,8 +36,6 @@ import visuald.config;
import visuald.intellisense;

import vdc.lexer;
import vdc.parser.engine;
import ast = vdc.ast.all;

import sdk.port.vsi;
import sdk.win32.commctrl;
Expand Down Expand Up @@ -157,7 +155,7 @@ class Declarations
canImport = (ext.length == 0);
else if(ext == ".d" || ext == ".di")
{
base = base[0 .. $-1-ext.length];
base = base[0 .. $-ext.length];
canImport = true;
}
if(canImport && base.startsWith(imp) && arrIndex(mNames, base) < 0)
Expand Down Expand Up @@ -293,47 +291,13 @@ class Declarations
int hr = textView.GetCaretPos(&line, &idx);

auto langsvc = Package.GetLanguageService();
ast.Module mod = langsvc.GetSemanticModule(src);
if(!mod)
string[] symbols = langsvc.GetSemanticExpansions(src, tok, line, idx);
if(symbols.length == 0)
return false;

bool inDotExpr;
TextSpan span;
span.iStartLine = span.iEndLine = line;
span.iStartIndex = span.iEndIndex = idx;
ast.Node n = langsvc.GetNode(mod, &span, &inDotExpr);
if(!n)
return false;

if(auto r = cast(ast.ParseRecoverNode)n)
{
wstring wexpr = src.FindExpressionBefore(line, idx);
if(wexpr)
{
string expr = to!string(wexpr);
Parser parser = new Parser;
ast.Node inserted = parser.parseExpression(expr, r.fulspan);
if(!inserted)
return false;
r.addMember(inserted);
n = inserted.calcType();
r.removeMember(inserted);
inDotExpr = true;
}
}
vdc.semantic.Scope sc = n.getScope();

if(!sc)
return false;
auto syms = sc.search(tok ~ "*", !inDotExpr, true, true);

int namesLength = mNames.length;

foreach(s, b; syms)
if(auto decl = cast(ast.Declarator) s)
mNames.addunique(decl.ident);
else if(auto em = cast(ast.EnumMember) s)
mNames.addunique(em.ident);
size_t namesLength = mNames.length;
foreach(s; symbols)
mNames.addunique(s);

sort!("icmp(a, b) < 0", SwapStrategy.stable)(mNames);
return mNames.length > namesLength;
Expand Down
1 change: 1 addition & 0 deletions visuald/dimagelist.d
Expand Up @@ -21,6 +21,7 @@ const kImageFolderOpened = 3;
const kImageResource = 4;
const kImageDocument = 5;
const kImageScript = 6;
const kImageDisabled = 7;

const IDC_TOOLBAR = 1010;
const IDC_FILEWHEEL = 1011;
Expand Down

0 comments on commit 17e7d3b

Please sign in to comment.